user2931500 user2931500 - 1 year ago 108
Javascript Question

Using javascript in offline Page

Im trying to create my own starting website. Its just a simple, local stored HTML document with some of my favourite Links.

Now, I want to load / run an external javascript code like

<script type="text/javascript" src=""></script>

This is for a small widget but doesn't seem to work. I uploaded the site then on a server and the widget showed up.

So, is it necessary to run a server (like apache or node.js) to compile the javascript or is there any other easier possibility?

Answer Source

Save a JavaScript file locally, then implement file scheme file:// in the URL value of the src attribute of your <script> tag, along with a path to your JavaScript file:

<script type="text/javascript" src="file://C:/localjavascript.js"></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download