homepage Welcome to WebmasterWorld Guest from 23.23.22.200
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
javascript .js source files...
Do all browsers import an external javascript file?
scorpion




msg:1473047
 4:38 pm on Mar 19, 2003 (gmt 0)

For all intents, can you assume your users browser supports external javascript source file includes? What is the best line to use to include an external javascript file that is compatible with say at least IE 4+ and Netscape 4.7+?

 

rpking




msg:1473048
 4:42 pm on Mar 19, 2003 (gmt 0)

Not really an answer to the question, but an extra point.

Howe can be sure your browser consistently imports external JavaScript and css files?

When using IE5+, I notice quite often that an external stylesheet or script file isn't imported, often with catastrophic consequences...

txbakers




msg:1473049
 4:42 pm on Mar 19, 2003 (gmt 0)

<script type="text/javascript" src="myjspage.js"></script>

scorpion




msg:1473050
 5:06 pm on Mar 19, 2003 (gmt 0)

why is it not imported?

universalis




msg:1473051
 7:35 pm on Mar 19, 2003 (gmt 0)

ALL modern browsers will understand reading external javascript files. I think even Netscape 2.0 could do this. All CSS-aware browsers can read external CSS files as well.

The javascript file won't be called if the user has javascript disabled - which is the case for about 10% of users. Also, search bots such as Googlebot won't call it as they don't look at javascript.

As for CSS, it is rarely disabled in the end-user's browser, so it will be called in most cases (except for the bots again).

Use:
<script type="text/javascript" src="myjspage.js"></script>

for javascript, or

<link rel="stylesheet" type="text/css" href="mystyles.css">

for CSS.

g1smd




msg:1473052
 9:33 pm on Mar 19, 2003 (gmt 0)

The issue isn't whether the browser can import external javascript files or not.

The issue is whether the browser actually understands javascript in the first place, and if it does, whether that feature is still enabled, or whether it has been disabled by the user.

For javascript-enabled browsers it does not matter whether the code is inside the HTML file, or is in an external .js file. The code will be treated the same way.

External javascript files make for a neater HTML page, allow code re-use across the entire site, and easier updating of the code. External javascript is the way to go.

tedster




msg:1473053
 1:00 am on Mar 20, 2003 (gmt 0)

When using IE5+, I notice quite often that an external stylesheet or script file isn't imported, often with
catastrophic consequences...

Yes, there's a bug there and I can't pin it down. I heard others mention it, but never saw it myself until a recent rebuild of this machine.

Now, even after trying three different builds of IE6, I am still stuck with it.

It's got to be relatively rare - some combination of browser plus OS plus other software of something like that. Else we'd have heard a loud complaint long ago.

rpking




msg:1473054
 9:23 am on Mar 20, 2003 (gmt 0)

> It's got to be relatively rare

I agree. I often it see with my own browser/OS setup it on a VERY high traffic site of ours, but I haven't heard of any complaints through customer services...

However, still fairly worrying. Even if it affects only 1% of users, that can work out to be a lot of users that may hit the back button.

I'd love to hear of a solution, but I can't believe that it would involve anything other than a reinstall of user software, which is sadly beyond our control.

rpking




msg:1473055
 9:29 am on Mar 20, 2003 (gmt 0)

By the way, I'm using IE5.50 on Win 98 Second Edition ver 4.10 if we want to start a comparative list.

I'm wondering if it's anything to do with some kind of scumware? i.e. something that interacts with the browser itself.

I've tried strenuously to avoid getting scumware on my box, but while I was away a while ago I think somebody else may have inadvertently installed some...

g1smd




msg:1473056
 9:13 pm on Mar 20, 2003 (gmt 0)

Something like AdAware from Lavasoft will quickly tell you what is there, and offer to clear it all away for you.

Be aware that it can give false alarms. A program that I use to plot the paths of Comets through the Solar System, installed as something like C:\Program Files\Comet\comet.exe was incorrectly identified as being a component part of Comet Cursor for example.

securecat




msg:1473057
 4:25 am on Mar 24, 2003 (gmt 0)

universalis wrote:
>I think even Netscape 2.0 could do this.

No. Although netscape supported JavaScript (SCRIPT element) from version 2.0Beta3, SRC attribute was supported from version 3.0Beta3.

Incidentally, IE supported the SCRIPT element from version 3.0Beta1, and also supported the SRC attribute from version 3.02.

tedster




msg:1473058
 5:49 am on Mar 24, 2003 (gmt 0)

anything to do with some kind of scumware?

Like those new RealOne message pop-ups I just started seeing, maybe? I've been looking for candidates in the most recent stuff, because I never saw the bug until the last few months. That obnoxiously invasive RealOne Player is high on my suspect list right now.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
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