homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
External JavaScript Files
Mac O/S 9 IE 5 Does not seem to support External JavaScript Files
rcsmoss

10+ Year Member



 
Msg#: 505 posted 12:46 pm on Apr 30, 2003 (gmt 0)

I am using external javascript files in some new web page designs I am creating. The following id the tag syntax in the head of each page:

<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?

 

BlobFisk

WebmasterWorld Senior Member blobfisk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 505 posted 1:00 pm on Apr 30, 2003 (gmt 0)

Welcome to WebmasterWorld, rcsmoss!

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

ShawnR

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 505 posted 1:19 pm on Apr 30, 2003 (gmt 0)

Do you have spaces in your filenames? New browsers substitute spaces for %20 before sending the requet to the server, but older browsers don't, so that is one possibility.

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

BlobFisk

WebmasterWorld Senior Member blobfisk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 505 posted 1:50 pm on Apr 30, 2003 (gmt 0)

Do you have any comment tags at the start of the external javascript file?

ShawnR's suggestion of the alert at the top of the script is a very good one - as he says, at least you'll know then if the script is being read or not.

Macguru

WebmasterWorld Senior Member macguru us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 505 posted 2:04 pm on Apr 30, 2003 (gmt 0)

>>The pages all dispay okay but none of the javascript functions work.

If none of the above works, you could also try to have a look at the browsers preferences to check if JS is activated.

Edit/Preferences/Web Browser/Web Content/Active Content/check Active sripting

rcsmoss

10+ Year Member



 
Msg#: 505 posted 5:25 pm on Apr 30, 2003 (gmt 0)

I have done all of the suggested options in regard to the following:

<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]

Macguru

WebmasterWorld Senior Member macguru us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 505 posted 5:36 pm on Apr 30, 2003 (gmt 0)

<!-- Did you read BlobFisk's message # 4? // -->
rcsmoss

10+ Year Member



 
Msg#: 505 posted 8:47 am on May 1, 2003 (gmt 0)

Finally - All is well.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved