0

I have an application that cannot use external scripts references. I've always being able to use any kind of script putting it inline, but with go.js it has not being possible. Is there any particular reason for this?

Sample of code:

<script src="../release/go.js"></script>
<script src="../assets/js/goSamples.js"></script>  <!-- this is only for the GoJS Samples framework -->
<script id="code">
  function init() {
...

When I change it to

<script>
(here I copy all the content of go.js)
(here I copy all the content of goSamples.js)
</script>

the webpage doesn't work. Could this be something related to

<script id="code">

?

Thanks for the help.

2 Answers 2

0

You do not need goSamples.js, for one.

There is nothing special about script id="code" in the context of this working. As long as go.js is parsed before

It probably does not work because you probably are not waiting for the DOM to load before trying to execute code that creates a Diagram. The DOM needs to be loaded because the Diagram relies on the DIV existing.

Note how all the samples have <body onload="init()">, which is calling the init() code after the body has loaded. I presume your code does not do this.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the help. The problem was that some required code was not inline (jquery, etc). As you've explicitly explained that there was nothing special about "script id='code'" I'm accepting this answer.
0

sample

you can click on above sample code. The script is written in inline.

Hope this helps :)

1 Comment

I'm sorry, it doesn't help. The script is not inline. There are two script tags with source indicated, exactly as my example code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.