2

The JavaScript code below is not loading, in the JavaScript console it says,

"Not allowed to load local resource:"

Javascript:

    (function () { 
        var script = document.createElement('script'); 
        script.setAttribute('src','file:///home/chronos/u-1dd073c6b7b8430c0010c7429b07db331325c324/Downloads/Core/tube.js'); 
        document.body.appendChild(script);
        }()
    );

2 Answers 2

2

This stuff is mostly pasted from other questions but perhaps you will find it useful:

Check if your host is fully qualified in here

You can also read a guide in here

Some browsers, like modern versions of Chrome, will even refuse to cross from the http protocol to the file protocol. Chrome and Safari seem to use a more strict implementation of sandboxing (for security reasons) than the other two.

Finally, you shouldn't load javascript files off a local filesystem. You need to have it hosted with your app and load it off the web server.

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

2 Comments

Thanks for the tip, it helped me a lot!
I'm glad to help! :)
-1

Create a python server using

python3 -m http.server 8086

and replace the

file:///<PATH_TO_FILE>

with https://localhost:8086/<RELATIVE_PATH_TO_FILE>

Comments

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.