Search code examples
javascripthtmlcssjsbin

How to run JSBin code on your computer?


I copied code from This JSBin Project on to my desktop into 3 files: index.html, style.css, script.js

I also included the lines in index.html:

 <link rel="stylesheet" href="style.css">
 <script type="text/javascript" src="script.js"></script>

but the script and style files don't seem to work when i open index.html in browser.


Solution

  • jsBin by default omits the http: in the URI see more about protocol relative URL

    <script src="//code.jquery.com/jquery.min.js"></script>
    

    you need to add it:

    <script src="http://code.jquery.com/jquery.min.js"></script>
    

    and so for all other script and link tags (if you're viewing your page from file: environment)

    See this jsBin http://jsbin.com/kumoyogegu/1/edit go to File > Download > and run it from desktop.

    (Otherwise, by omitting http: you should correctly see your pages once uploaded to a live server or working from localhost)