Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-26104

Some JavaScripts are not executed if included in User Macro

XMLWordPrintable

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Some JavaScripts are not successfully executed if included in User Macro, whether or not the JS is included in .js file or is included directly into the macro template between <script></script> tags.

      Steps to reproduce

      1. Download the attached jquery.zrssfeed.min.js file and put it into <confluence-install>/confluence folder
      2. Create a new user macro
      3. Add the following user macro template and change <confluence-url> below into your Confluence Access URL:
        ## @param URL:title=URL|type=string|required=true|desc=The URL of the RSS Feed
        
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
        <script src="http://<confluence-url>/jquery.zrssfeed.min.js" type="text/javascript"></script>
        
        <div id="feedtarget"></div>
        
        <script type="text/javascript">
        AJS.$(document).ready(function () {
          $('#feedtarget').rssfeed('$paramURL', {
            limit: 5
          });
        });
        </script>
        
      4. Create a new page
      5. Insert the newly created macro and add this URL feed into the macro settings: http://feeds.bbci.co.uk/news/rss.xml
      6. Save the page

      Nothing is shown in the page. Note that this was previously working in Confluence 3.5.13.

      Workaround 1
      Insert a HTML macro (make sure to enable the plugin module first) and add the following codes: (and delete these codes from the User Macro)

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
      <script src="http://<confluence-url>/jquery.zrssfeed.min.js" type="text/javascript"></script>
      

      Workaround 2
      Insert the code above into Custom HTML (At end of the HEAD). Don't forget to delete these codes from the User Macro.

        1. Invalid HTML.jpg
          Invalid HTML.jpg
          82 kB
        2. jquery.zrssfeed.min.js
          3 kB

              Unassigned Unassigned
              asanusi AmaliaA
              Votes:
              87 Vote for this issue
              Watchers:
              64 Start watching this issue

                Created:
                Updated: