How to include a remote Stylesheet or JavaScript in a widget

Former Member
Former Member

How do I include remote stylesheets or JavaScripts in a widget?

Parents
  • Hi . The techniques for including remote scripts are identical to local.

    For CSS, you can add a <link> element referencing the stylesheet as follows:

    $core_v2_page.AddLink('stylesheet', $styleSheetUrl, "%{ Position = 'AfterTheme' }")

    For JavaScript, you can just render a <script> tag directly, or if you prefer, use the #registerEndOfPageHtml directive.

    #registerEndOfPageHtml()
    	<script src="$core_v2_encoding.HtmlAttributeEncode($javaScriptUrl)"></script>
    #end

Reply
  • Hi . The techniques for including remote scripts are identical to local.

    For CSS, you can add a <link> element referencing the stylesheet as follows:

    $core_v2_page.AddLink('stylesheet', $styleSheetUrl, "%{ Position = 'AfterTheme' }")

    For JavaScript, you can just render a <script> tag directly, or if you prefer, use the #registerEndOfPageHtml directive.

    #registerEndOfPageHtml()
    	<script src="$core_v2_encoding.HtmlAttributeEncode($javaScriptUrl)"></script>
    #end

Children
No Data