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

            [CONFSERVER-26104] Some JavaScripts are not executed if included in User Macro

            Caterina Trainito added a comment - - edited

            Simon's solution for the issue collector macro worked for us on Confluence 7.20. Thank you!

            Caterina Trainito added a comment - - edited Simon's solution for the issue collector macro worked for us on Confluence 7.20. Thank you!

            Kernebone added a comment -

            Thanks Simon. That fixed my problem.

            Kernebone added a comment - Thanks Simon. That fixed my problem.

            This issue gets mentioned for quite some time now, on the 'Advanced use of the Jira Issue Collector' Docu page.

            While I can confirm, that the Issue Collector does not work if pasted into a user macro as-is,
            I also find that it does work, as soon as I put the script-closing-tag (</script>) on a new line in the user macro source.

            In the above example, that would correspond to instead writing

            <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>
            

            We are on Confluence 7.3.3, but I believe this used to work in earlier versions as well, in this manner.
            Can someone confirm?

            Simon Tost [TNG] added a comment - This issue gets mentioned for quite some time now, on the 'Advanced use of the Jira Issue Collector' Docu page. While I can confirm, that the Issue Collector does not work if pasted into a user macro as-is, I also find that it does work, as soon as I put the script-closing-tag ( </script> ) on a new line in the user macro source. In the above example, that would correspond to instead writing <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> We are on Confluence 7.3.3, but I believe this used to work in earlier versions as well, in this manner. Can someone confirm?

            Almost 6 years later ... Confluence Server 6.6.2 here.

            Luís GÓIS added a comment - Almost 6 years later ... Confluence Server 6.6.2 here.

            Pretty major impediment on our end. Having to embed the issue collector using html means more code exposed to end users and more to potentially break.

            Ameen Belbahri added a comment - Pretty major impediment on our end. Having to embed the issue collector using html means more code exposed to end users and more to potentially break.

            +1 - a fix for this would be very helpful.

            Mark Stramaglia added a comment - +1 - a fix for this would be very helpful.

            I need this as well.

            Ismar Slomic added a comment - I need this as well.

            Need this

            Ben Arundel added a comment - Need this

            Any progress here? Seems to be a tiny fix that is needed here and could help quite much in integrating JIRA into our Intranet.

            Cedric Weber added a comment - Any progress here? Seems to be a tiny fix that is needed here and could help quite much in integrating JIRA into our Intranet.

            I totally agree with Jansen Davis! And it is a shame that a) it is deemed a minor bug and b) that has been assigned for one and a half year Atlassian markets its products with emphasis on working together - and this bug is at the core of the marketing idea and should be fixed - or even better, a much more elegant integration for JIRA issue collector is implemented, something where we do not need to code even a user macro

            BTW, how does workaround #2 work with the new standard design theme? Do I have to edit the "main site layout"? Maybe this can be updated here.

            Does not seem to work on 5.3, either, but did no extensive checking yet.

            Peter Scheidt added a comment - I totally agree with Jansen Davis! And it is a shame that a) it is deemed a minor bug and b) that has been assigned for one and a half year Atlassian markets its products with emphasis on working together - and this bug is at the core of the marketing idea and should be fixed - or even better, a much more elegant integration for JIRA issue collector is implemented, something where we do not need to code even a user macro BTW, how does workaround #2 work with the new standard design theme? Do I have to edit the "main site layout"? Maybe this can be updated here. Does not seem to work on 5.3, either, but did no extensive checking yet.

              Unassigned Unassigned
              asanusi AmaliaA
              Affected customers:
              87 This affects my team
              Watchers:
              64 Start watching this issue

                Created:
                Updated: