Forum Moderators: open

Message Too Old, No Replies

external vs. inline JavaScript

Still users out there not JavaScript enabled..a concern?

         

JamieBear

12:02 am on Nov 11, 2004 (gmt 0)

10+ Year Member



Currently we have JavaScript in external .js files. All is well, but from a customer service standpoint, we continue to get questions from users who don't have JavaScript enabled on their browsers, and therefore can't get into our site.

So...we are toying with the idea of no longer using external files and putting the JavaScript inline in the HTML. We see some highly ranked sites with beaucoup JavaScript in their HTML...

We're weighing this against --

1) Increased weight of our pages. We are already dangerously near the 101K limit.

2) The fact that the spiders would "presumably" lower the relevancy of our keywords if there is JavaScript in the <HEAD>. (Is this really an issue?) We could put the JavaScript at the bottom, but want to adhere to the emerging W3C standards.

3) Slower page load time on secondary loads, because the JavaScript wouldn't be in cache.

Your opinion...should we leave our external .js files as is?

Thanks so much, in advance, for your feedback.

adni18

12:45 am on Nov 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



absolutely. you can include messages to people who don't have JScript enabled using the <noscript> tag.

JAB Creations

7:12 am on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually this is yet ANOTHER IE issue. IE will NOT render some JS when it's external while it will when it is internal.

If a customer is having issues with the site being JS and they didn't turn it off I'll place my bets on it being a browser issue. Get their UA and test it yourself. The only instance I can think off the top of my head is if it's a computer newb who is on some anti-js person's computer who has js disabled.

RonPK

8:12 am on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> IE will NOT render some JS when it's external while it will when it is internal.

Could you please give some examples?

Bernard Marx

9:54 am on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Second that. It may well be true about IE not recognising external scripts, but it's certainly the very first time I've heard about it.

Back to the main thrust..

So...we are toying with the idea of no longer using external files and putting the JavaScript inline in the HTML

What's that to do with the price of eggs?

Whether the script is internal¦external will have no effect the issue of people with Javascript disabled. It's generally accepted that sites¦pages should be fully accessible without JS, which should be used to enhance content, and its delivery.

Keep your scripts external (bandwidth, script integrity, SEO)

It looks like your site will need a "new paradigm". Overall, you have a choice between restructuring pages, or offering alternative content. The second isn't always convenient to deal with.

We see some highly ranked sites with beaucoup JavaScript in their HTML...

I'd hazard a guess that even some of the "best" are being knocked together with authoring packages, and the "authors" in question aren't bothering to use (or haven't quite got their heads round) external scripts.

adni18

1:23 pm on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



make sure there is nothing in-between the

<script language=javascript src="gui.js">

and the

</script>.

Even a line break or space could ruin it. Make sure it is consistent:

src="gui.js"></script>

JamieBear

5:37 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



Thank you all for your replies on this item. It was very helpful.