Asdfg
Asdfg

Reputation: 12213

how to load javascript file from absolute network path

Is there a way i can define my script tag to use absolute path instead of relative path so that my JavaScript files are loaded from a network location?

This is what i have tried:

<script src="file:\\\MyDFSDirectory\Test\TestApp\Scripts\jquery-1.7.1.js"></script>

This does not work. in FF, i get the error Security Error: Content at http://localhost/Test/Test.html may not load or link to file:\\\MyDFSDirectory\Test\TestApp\Scripts\jquery-1.7.1.js

In IE, I dont see the file being downloaded. In Network Tab (IE Dev Toolbar), it shows Received 0 B. If i take the URL and paste it in the File Explorer, it opens the JS file.

What am i missing here?

Upvotes: 3

Views: 2592

Answers (1)

Matt
Matt

Reputation: 802

You are indeed running up against the security model of the browsers. The only way around this is to run a web server locally and serve up the files that way.

Upvotes: 4

Related Questions