Taras_96 said the following on 11/1/2006 5:33 AM:
>Again, your logic is backwards.
if(javascriptEnabled){redirect}else{print out error page}
I think the contrary. IMO, when I'm coding, I tend to react on errors,
rather than reacting on the lack of errors.
The error isn't JS enabled or disabled. The error is depending on JS and
when you depend on it, you have to react to that error. And the most
reliable way (the only way) to know if script is enabled is for script
to tell you.
The code above reacts on the lack of errors - your logic is reacting
(redirecting in this case) based on the absence of an error (in this
case the error being javascript disabled).
No, it reacts to a confirmation of the features I want. In your case,
the feature you want is JS enabled. The only way to know if that feature
is available is to test for it. Then use it. And only JS can tell you
that. You are trying to test for the lack of a feature that needs the
feature to tell you if it's there or not.
Furthermore, I don't like your solution because it penalises users that
are doing the right thing - enabling javascript (well, its the right
thing in my context anyway). Those that have javascript enabled have to
send an extra request each time they want to view a new page.
If the time it takes a user's PC to process an intro page with a single
line of script is that big a deal, you are in the wrong business. Sites
redirect all the time and the delay is negligible. And most people will
simply not pay attention to it.
Secondly, I would need to rewrite all of the links throughout the site
to go to this error page, and then make the error page repost all of
the form variables. This isn't impossible, but I was hoping for an
easier, cleaner solution.
Actually, you don't. You include a snippet of script in every page that
hides a div tag wrapped inside the body, with a message above it. Script
would hide the message and show the body div. Without script, or with an
error, the user gets useful information. If your pages are server
driven, set an include to put it all there. If not, open all your static
files in something like Notetab and do a global search and replace
across all documents and replace the body tag with something like this:
<body>
<div id="noScript" style="visibility:visible">This site requires script
to be enabled. Either you have it disabled or there was a script error
on the page</div>
<div id="theBody" style="visibility:hidden">
And then replace the closing body tag with </div></body>
Then replace your closing head tag with:
<script type="text/javascript">
function showThePage(){
document.getElementById('noScript').style.visibili ty = "hidden"
document.getElementById('theBody').style.visibilit y = "visible"
}
window.onload = showThePage;
</head>
You will have problems with that if there are other onload routines though.
>Just for you though, redirecting me to a page that says "You need to
enable Javascript" would make you look pretty intelligent to users of
UA's that don't even support JS. How do you enable something the UA
doesn't support?
....
>So, what do users with Script and META disabled get???
Maybe I should have been a bit clearer. The website is targeted at a
group that is generally computer illiterate,
So you are worried about "computer illiterates" disabling a feature that
99.99% of those people don't even know exist?
meaning that probably 90% of the users will be running IE on Windows.
Probably closer to 99% of the users and 99% of those users won't even
know what JS is or how to disable it. So, you are trying to cover .01%
of your users.
The other 10% will almost definitely have some UA that does support
javascript.
Never used a Cell Phone Browser then I assume?
If not, well, you're going to have to install another browser.
Install another browser on my Cell Phone? Can you give me directions on
how to do that?
IMO, saying to your users that 'you must enable javascript', although
not ideal, is not the end of the world.
That's not what you are saying though. Think about it. "I know you are
computer illiterate and probably don't know what JS is but please enable
a feature that you don't even know what is". I don't know of a JS
browser that doesn't default to scripting enabled.
The website's functionality is a product, and like lots of software
products, there are prerequisites to running this product. We see
similar situations everyday - 'this software requires Windows',
'this software requires Linux', etc.
Daily occurrence. The difference is in how you choose to enforce that
requirement.
Having the META disabled is a problem, and was the type of information
I was looking for.
>>I came up with the idea of using a meta tag in a <noscriptsection,
and was hoping to get suggestions from this newsgroup. What I'm
suggesting is essentially:
It's a dumb idea.
Why? Constructive criticism would be nice. I think it would be a good
idea if you couldn't disable META.
Why? Half the porn sites I see start off as an innocent site that
redirects to the real porn using META redirects.
>><html>
<noscript>
<meta http-equiv="refresh" content="2;url=http://webdesign.about.com">
</noscript>
QST - do you have to put the absolute URL in, and can the time be zero?
Did you test it? I bet you didn't or you wouldn't have to ask.
I was more after what the standards say about the above attributes, and
what browser support is there for those standards and if the browsers
divert from the standards, how do they divert? I could test it in the
browsers I have, but I wanted to know how the browsers out there react.
The biggest problem with NOSCRIPT isn't support or lack of support, it
is in the inadequacy of the element. If a page has a JS error in it -
for any reason - the JS enabled browsers won't get anything but the
error message.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -
http://jibbering.com/faq
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/