Uploaded image for project: 'SlamData'
  1. SD-1842

Improper formatting of Javascript code causes iframe embedding to fail

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: SlamData
    • Labels:
      None

      Description

      The following JavaScript code is provided by SlamData to embed a Workspace within an iFrame:

      <script type="text/javascript">
      (function() {
        var uri = "http://localhost:8080/files/workspace.html#/devguide/devdb/Average+Height+by+City.slam/fdb8b56d-e796-4686-9d42-0b32766f01bd/view";
        var iframe = "<iframe width=\"100%\" height=\"100%\" frameborder=\"0\" src=\"" + uri + "\"></iframe>"  document.writeln(iframe);
      })();
      </script>
      

      Notice the document.writeln(iframe); is on the same line as the instantiation of the iframe variable.

      Changing the code to either put this on its own line of code, or inserting a semicolon between the two statements fixes the problem.

      Otherwise you get the following error in the JavaScript console and the iframe does not render

      Uncaught SyntaxError: Unexpected identifier
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              damon Damon LaCaille
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: