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

Some JavaScripts are not executed if included in User Macro

    XMLWordPrintable

    Details

      Description

      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.

        Attachments

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

          Issue Links

            Activity

              People

              • Votes:
                55 Vote for this issue
                Watchers:
                46 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Last commented:
                  1 year, 22 weeks, 4 days ago