2

ON my local I am testing out stuff I've built.

This is the script I am trying to include in a file in the same folder:

<script src="/colorpicker/js/evol.colorpicker.min.js" type="text/javascript" charset="utf-8"></script>

The colorpicker is on my desktop in a folder called Work/demo/

The colorpicker is not working. What an I do to make it work on my local?

2 Answers 2

4

There are a number of things (but mostly XMLHttpRequest) that can be done using JavaScript that will be blocked from file:/// URIs for security reasons in some browsers. In general, for development purposes, I strongly recommend installing a web server (either directly on your workstation or in a virtual machine) and using that for testing.

That said, if you do want to test without a web server, then don't use root relative URIs. i.e. Do not start your URIs with a / character as that will hit the top of your file system, not the top directory that you consider to be part of your site.

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

1 Comment

One of the easiest ways to run a web server for development is python's SimpleHTTPServer. Simply install python on your system, and run python -m SimpleHTTPServer in the directory you'd like to serve files from. Then browse to 127.0.0.1:8000
0

Since The script file is in the same folder with your HTML page, so you just have to include it with its file name only:

<script src="evol.colorpicker.min.js" type="text/javascript" charset="utf-8"></script>

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.