4 Replies - 1717 Views - Last Post: 16 March 2013 - 12:58 PM

#1 zeion   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 23-September 12

Nothing loads when I open a HTML file locally;including jQuery library

Posted 16 March 2013 - 09:54 AM

When I try to open a HTML file locally (ie. not served through a server or localhost, but just as a local document from my browser) no resources gets loaded according to Firebug net panel; so I cannot load the jQuery library either and no scripts work. I have tested this with numerous example code already. Why does this happen?

Library loads fine when I try to load a page served through node.js server locally on a port server; and also loads fine when I load pages online.

I am trying to run this:

<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.9.1.min" ></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>



But Firebug Net panel shows no libraries being loaded:

Posted Image


Libraries load when served through nodejs:

Posted Image

PS: I've also tried online references to library like
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>

Is This A Good Question/Topic? 0
  • +

Replies To: Nothing loads when I open a HTML file locally;including jQuery library

#2 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Nothing loads when I open a HTML file locally;including jQuery library

Posted 16 March 2013 - 10:25 AM

The Net tab is for analyzing network traffic, so in the first instance there isn't any. The src should also have a .js file extension.

In the second instance I need to include the "http:" protocol at the beginning of the link-path.
Was This Post Helpful? 2
  • +
  • -

#3 zeion   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 23-September 12

Re: Nothing loads when I open a HTML file locally;including jQuery library

Posted 16 March 2013 - 12:24 PM

Thanks that seems to have solved it; but is there a way to see what libraries are loaded through Firebug or some other way?

This post has been edited by Dormilich: 16 March 2013 - 05:51 PM

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Nothing loads when I open a HTML file locally;including jQuery library

Posted 16 March 2013 - 12:31 PM

The Script tab :)/>

This post has been edited by Dormilich: 16 March 2013 - 05:51 PM

Was This Post Helpful? 2
  • +
  • -

#5 zeion   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 23-September 12

Re: Nothing loads when I open a HTML file locally;including jQuery library

Posted 16 March 2013 - 12:58 PM

Thanks!

This post has been edited by Dormilich: 16 March 2013 - 05:51 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1