I am having difficulty loading my external js file

This is probably very simple but here is my problem. I am using Parse as my application server and have a very complex screen using lots of javascript functions. It seems like I ran out of space in the “Javascript” section of the “Meta Tags & HTML Code” pane of my webpage.

So, I am saving all of that code in a js file but can’t get it to load.

I know it is probably very silly but anyone could point me in the right direction?

Cheers,

If I do a view source, I can see at the end:

	<link rel='stylesheet' type='text/css' media='all' href='files/stacks_page_page1.css' />
	<script type="text/javascript" src="myStuff.js"></script>
	
</head>
<body>

In the “Meta Tags & HTML Code/Javascript” I have the following:

document.getElementById(“myDiv”).innerHTML = initMyStuff();

It does not look like “initMyStuff” is found.

@hgg is your “myStuff.js” file in the same folder as the page that is referencing it? Path is important and may explain your issue?

Hope it helps
Brad

Hi Brad, where should I put “myStuff.js”? On the same directory where the rw6 file is? I have tried that but does not work.

@hgg

You need to import it into your site resources by dragging it from your finder window into the Resources section of the site on the Right Lower side, and reference it from there in your page 'Meta Tags & HTML Code (under Inspector on right side - the** i** symbol), select header, add (script type=“text/javascript” src=“%resource(myStuff.js)%”) (/script), assuming you just import it into the root of the resources. Alternatively, if this is a site wide use javascript file, you can use Site preferences (Wrench icon), code section, Head sub-section, and use the same HTML I reference above).

If you make a folder under resources for javascripts, say Java, then the path for the resource would be:

src="%resource(Java/myStuff.js)%

This should upload your JS file to the resource folder and the page referencing it should be able to find it.

Hope that helps
Brad

Thanks Brad, works beautifully. :slight_smile:

@hgg, Sweet, glad it’s working for you :slight_smile: