Forum Moderators: mack
<script language="javascript" src="/jsfiles/filename.js"></script>
This all works fine on any PC with either IE 6 or Netscape 7. The problems start to arise when trying to view these pages on a Mac running either O/S 9 or O/S 10 with IE 5. The pages all dispay okay but none of the javascript functions work. It seems as though the Mac's do not understand the use of an external javascript file. I am also using external CSS style sheets which do work.
Do I have to re-include all the javascript code in each page to work correctly on Mac's?
Try removing the first / from your scr call, so that it looks like:
src="jsfiles/filename.js"
The leading / tells the browser to use site relative pathing (ie, go up to the site root and work your way down). I'd guess that you are using document relative pathing (from the documents location, follow this path), which omits the leading /.
Also, you should use the type attribute (language is deprecated):
type="text/javascript"
HTH
Another possibility is that the javascript file is being read, but not executing because of some incompatibility between DOM implementations.
Try an alert("hello world\n"); at the top of your external javascript file to see if the problem is with the file not being read vs a problem in the javascript in the file.
Shawn
<script language="javascript" type="text/javascript" src="/jsfiles/filename.js"></script>
I have also tried putting the external file in the same directory as the other files, no difference.
1. Yes the files is there because it works on with a pc browser
2. Yes the file is where I think it is
3. Yes the path name is correct otherwise it would not work on a pc
4. No, the js file does not contain any html tags or comments since I just removed them as well.
Thanks for all your great suggestions, keep them coming....
[edited by: WebGuerrilla at 5:36 pm (utc) on April 30, 2003]
[edit reason] No Specifics Please [/edit]
Apparently when you refresh a pc browser it not only re-loads the current page but also reloads any external source files (CSS .js).
On the Mac, however, this is not the case. Refresh only re-loads the current page and not any external source files.
Turns out the problem was one of my form validation functions. I have since replaced this function with a new one and all works great on both PC and Mac.
Thanks again to all who gave their time and suggestions.
RM