I am testing an html webpage and it is failing to load a local jquery.json-2.4.0.js. I am testing the html page locally from chrome. When the page loaded I get a net::ERR_FILE_NOT_FOUND.
Why is it unable to load the file? This file has been moved from a different server (which it was working fine on), but the directory paths are the same (I double checked the path ).
Here is my line:
<script type='text/javascript' src='/webforms/ExperianEmailJsScripts/jquery/js/jquery.jsonp-2.4.0.js'></script>
Remove the first / in the path. Also you don't need type="text/javascript" anymore in HTML5.
This error means that file was not found. Either path is wrong or file is not present where you want it to be. Try to access it by entering source address in your browser to check if it really is there. Browse the directories on server to ensure the path is correct. You may even copy and paste the relative path to be certain it is alright.
I got the same error using:
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">
But once I added https: in the beginning of the href the error disappeared.
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">
Same thing happened to me. Eventually my solution was to navigate to the repository using terminal (on mac) and create a new js file with a slightly different name. It linked immediately so i copied contents of original file to new one. You also might want to lose the first / after src= and use "".
Sometime when you downloading a project from other people, they might have some special customization. So, in my case I downloaded this project https://github.com/thecodercoder/fem-easybank
And got these errors: Failed to load resource: net::ERR_FILE_NOT_FOUND
That happed because the creator was using the /dist folder customization.
https://youtu.be/aoQ6S1a32j8?t=309
SOLUTION: you open Notepad++ press: Ctrl + F for search
find all folders that starts with / as in the picture and replace with norma ones like:
/dist/ to dist
Instead of:
path.join(__dirname, '/dcp-electron/index.html')
you should add a dot at the start of the path, to indicate that the path is relative:
path.join(__dirname, './dcp-electron/index.html')
this can happen when you have the base tag, as explained in other answers
<base href="/">
Related
I am coding a PHP website homepage using a MAMP localhost server. I would like to connect the main HTML file to a javascript file, but when I do so, none of the javascript is executed, and an error that says Failed to load resource: the server responded with a status of 404 (Not Found) appears.
I have tried using the absolute file path when including the file under the src attribute (though the js file is in the same folder as the main html file anyway). I tried turning the server on and off and reloading the page several times, but the error still appears.
<head>
<script type="text/javascript" src="/homescript.js"></script>
</head>
<body onresize="changeHeaderDisplay()" onload="responsiveCarousel()">
</body>
The forward slash at the beginning of the filename in the script tag is the problem :
src="/homescript.js"
When your browser sees a forward slash, it assumes the file is at the top level of the domain it's searching. So if your html file is at:
file:///Users/Jack/test_program/index.html
it is searching for homescript.js at:
file:///homescript.js
To make it search for it at:
file:///Users/Jack/test_program/homescript.js
simply remove the leading forward slash:
<script type="text/javascript" src="homescript.js"></script>
Edit: On a website, it's the same phenomenon:
With leading slash:
http://www.example.com/homescript.js
Without leading slash: http://www.example.com/test_program/files/homescript.js
I'have been working on a project which totally works on jsfiddle.net . However, when i try to run this project in webStorm, i get two errors.
first :
second :
Before, i post my question here, i searched on stackoverflow but couldn't find any solutions. I already did :
libraries:
and my html codes :
<!DOCTYPE html>
<html>
<head>
<title>Super Mario!</title>
<link rel='stylesheet' type='text/css' href='myMario.css'/>
<script type='text/javascript' src='//code.jquery.com/jquery-1.11.2.min.js'></script>
</head>
<body>
<img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/mario.jpg"/>
</body>
</html>
why did u get these errors although i loaded libraries and succesfully defined source script in my html ? what should i do ?
You need to select this file link and click Alt + Enter to download this file to your library.
Screen from WebStorm:
Seems that you get the error when running your .js file directly, via 'Run file_name.js' in it's right-click menu, right? When doing this you are running it using Node.js. But 'document' can't be used in server-side scripts executed by Node.js. It is only defined in client-side javascript, i.e. when running in the browser via a tag in the rendered HTML, not the Javascript API engine running on the server. BTW, your .js file is not even included in your HTML page, as far as I can see from HTML code snippet...
This is not actually an error... WebStorm can't use remote resources available through CDN links for completion. Once it 'sees' such links, it searches for the corresponding library in ~.WebStorm9\system\extLibs\, and, if matching library is not found, prompts you to download it by showing this warning.
You can either suppress this warning or agree to download the library: hit Alt+Enter and then either hit the right arrow and choose 'Suppress for tag' or hit Enter to download.
When I try to include less.js it gives me a XmlHttpRequest Exception 101.
I include the .less file like this:
<link rel="stylesheet/less" type="text/css" href="anything.less" />
Now, I'm working on a Tumblr theme, and this ONLY happens when I upload the theme to Tumblr.
Both files are included correctly, I can reach the real files by clicking the links in the source code.
Can anyone help me with this one?
I used this for production only. It's very time consuming to compile the less file locally, embed it into the template and then upload it again.
Not a duplicate of:
LESS CSS minimal setup failure
I'm using Safari, and I'm using a global url (http://somelink.com/style.less).
You said:
The html file is then on www.tumblr.com, and the .less file is on
themelandia.com
This means that less.js file must make a cross domain ajax request in order to retrieve your .less file. Browsers do not allow this, and thus the request fails.
If you want to fix your problem, you must put the .less file somewhere on tumblr.com
For some reason my html file's request for my jquery.js file fails, however when I enter that exact url into a new tab in the browser, I get the exact jquery.js file I am trying to get when the website loads.
My code is as such:
<script src="js/jquery.js"></script>
and my website is here. If you append jquery.js to the root, you will see the exact file.
Can anyone explain why the file isn't properly retrieved when the website loads?
Any help is greatly appreciated.
At the beginning of your HTML file is this:
<!DOCTYPE html>
<html manifest="appcache.appcache">
The appcache.appcache refers to the file appcache.appcache whose content is:
CACHE MANIFEST
# V1.65 1-18-2013 10:15 PM
# cache
index.html
about.html
services.html
contact.html
css/signika.css
css/mq.css
css/index.css
css/about.css
css/services.css
css/contact.css
assets/signika_400.woff
assets/signika_600.woff
js/html5.js
js/index.js
js/mq.js
js/services.js
mail.php
images/chicken.png
images/salad.png
images/soup.png
images/steak.png
images/wontons.png
As you can see jQuery.js is not there. I suggest you to add js/jQuery.js into a new line and try again.
I figured this out by:
Running the Fiddler software side by side with Chrome (on Windows).
Loading your website in Chrome with Developer Tools (Ctrl+Shift+I on Windows, Command ⌘+Option ⌥+I on Mac), then go to the Network tab.
Then I see that Chrome loads appcache.appcache from the second time onwards and there's an error when loading jQuery.js.
The manifest attribute refers to the HTML5 cache manifest file.
Tutorial:
http://www.html5rocks.com/en/tutorials/appcache/beginner/
More references:
http://caniuse.com/#search=manifest (browser compatibility)
http://en.wikipedia.org/wiki/Cache_manifest_in_HTML5 (wiki)
https://www.google.com/search?q=html5+manifest
It's probable that the HTML file containing the script header in question is not in the "root" but perhaps in the same JS folder or somewhere else.
So technically this should work:
<script src="/js/jquery.js"></script>
Just keep in mind that this path is relative.
I have a base html file which I want all other pages to inherit certain charateristics from. But although my inherited pages eg. main.html can reference external links eg:
<link href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.css" rel="stylesheet">
With no problem. But when I try to download the twitter bootstrap and store the file in the same directory as all the other html pages it cannot link to that file and it gives me a 404 error. My file structure is simple; a folder called templates with all the html, css and js files in this directory.
So i'm doing this:
<link href="bootstrap.css" rel="stylesheet" media="screen">
When I try to do this:
<link href="http://localhost/templates/bootstrap.css" rel="stylesheet" media="screen">
I get no 404 error, but from the view source on the web page, if I try to access that page I get an error saying:
Firefox can't establish a connection to the server at .
I'm really lost to why this 'simple' thing is not working.
Do you have a base tag inside your html? If so, it could be saying firefox a specific host where to find files, different than localhost.
Try use Firebug on Firefox or Chrome developer tools to see which URLs it's trying to retrieve.