Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
172
rated 0 times [  178] [ 6]  / answers: 1 / hits: 16640  / 10 Years ago, fri, june 6, 2014, 12:00:00

I am getting a random error when I attempt to link a javascript file to my web page. It has been a while since I have done any web development. However, I have checked old code and the methods are identical. I am attempting to use jquery for the first time and am not sure if that is effecting the results.



Here is the HTML header:



<!DOCTYPE html >
<html>
<head>
<link rel=stylesheet href=Styles/layoutStyles.css type=text/css>

<meta content=text/html; charset=UTF-8>

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js”></script>
<script src=”CommonMethods.js” type=text/javascript></script>

<title>Insert title here</title>
</head>


The CommonMethods.js file is the file I am attempting to use. It was initially in a lower directory then the HTML file. However, I moved it to the same directory for testing purposes.



This is the error I get:



GET file:///D:/Users/Thomas.Thomas-TOWER/Dropbox/Workspaces/Eclipse_Web_Develop…nder/WebContent/%C3%A2%E2%82%AC%C2%9DCommonMethods.js%C3%A2%E2%82%AC%C2%9D net::ERR_FILE_NOT_FOUND 


I am not sure where the %C3%A2%...ect. symbols came from. I am almost wondering if there is something wrong with the way I defined the charset.



Any suggestions?



I should also mention I am using Eclipse for this project.


More From » jquery

 Answers
8

You're using smart quotes. Open the file in a real IDE (Netbeans, Eclipse, ShiftEdit, Coda, etc.) and replace them.



Also it's generally good practice to root script/style urls. (I.E. /CommonMethods.js)



On any larger project relative urls can be problematic as you're not always at the root.



Another tip would be protocol-less URLs for 3rd party scripts (I.E. //ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js)



All modern browsers support this and it saves you headache from insecure content being run on a secure page



Also as of HTML5 type=text/javascript is not longer required on script tags.



Also if you are using Visual Studio, Please remember to set Copy to Output Directory to Either Copy Always or Copy if Newer.


[#70694] Wednesday, June 4, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marissatinao

Total Points: 447
Total Questions: 90
Total Answers: 93

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;