Rendering Javascript from an HTML macro in a Confluence page breaks the edit functionality

XMLWordPrintable

    • 3
    • Severity 3 - Minor

      Summary

      Rendering Javascript from an HTML macro in a Confluence page breaks the edit functionality

      Environment

      • Confluence 5.9.4
      • Chrome, Firefox, Safari

      Steps to Reproduce

      1. In a space with the default theme:
      2. Enable the HTML macros
      3. Add the following code inside of the macro
        <!-- TradingView Widget BEGIN -->
        <script type="text/javascript" src="https://s3.amazonaws.com/tradingview/tv.js"></script>
        <script type="text/javascript">
        new TradingView.widget(
        { "width": 862, "height": 250, "symbol": "NASDAQ:TEAM", "interval": "D", "toolbar_bg": "#E4E8EB", "hide_top_toolbar": true, "allow_symbol_change": true, "save_image": false }
        );
        </script>
        <!-- TradingView Widget END -->
        
      4. Save the page
      5. Edit the page

      You can also try the following, which breaks the editor in a different way:

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
      </script>
      

      Expected Results

      Page is editable and you can change the code within the macros

      Actual Results

      Instead of taking you to the editor, Confluence displays the same URL to view the page, and it shows the JavaScript macro in a page. You cannot edit the page this way.

      Thing I've tried

      Place the code in an HTML macro within the 'Excerpt' macro in another page, then include this excerpt in your target page. This still breaks the editor.

      Place the JS code in a user macro, then add that user macro to a page. This breaks the editor too.

      Workaround

            Assignee:
            Unassigned
            Reporter:
            Daniel Ponzio
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: