![]() |
make document/ website viewable only when JavaScript is enabled
Hello,
I would like to know how to make a website (in this case, a parent div) viewable only if JavaScript is enabled? I tried to develop a code that can do this, but could not find the solution. Code:
<html> |
Making it way too hard.
Code:
<html> |
i use css for this:
Code:
<html> |
Quote:
|
Write the entire DOM with JavaScript. :rolleyes:
|
Quote:
Code:
<head>or, use my crypto app, but hard-code the password by defining a PW string var of the password: Code:
<html> <script>PW="defaultPassword"; eval( unescape( "function%20jcipher%28p%2Cs%29%7Bvar%20i%3D0%2CP%3D0%2CK%3D0%2Cb%3D%22%22%2CMax%3D0%2Cd%3D%5B%5D%3Bif%28p.slice%280%2C3%29%3D%3D%22zz%2C%22%29%7Bvar%20slen%3Ds.length+1%3Bd%3Dp.split%28%22%2C%22%29%3Bp%3D%22%22%3Bvar%20junk%3Dd.shift%28%29%2CScc%3DString.fromCharCode%3BMax%3Dd.length%3Bvar%20tr%3D%5BMax%5D%3Bfor%28var%20i%3D0%3Bi%3CMax%3Bi++%29%7BP%3Dd%5Bi%5D%3BK%3Ds.charCodeAt%28i%25slen%29%3Btr%5Bi%5D%3DScc%28P%5EK%29%3B%7Dreturn%20tr.join%28%22%22%29%3B%7Dreturn%20false%3B%7D%0A" ) ); this works with css, works with meta refresh blocking, and requires js to even read the source by any human. |
There isn't really any purpose served by trying to obfuscate the code since the final HTML that it generates is easy to view regardless using either one of the development tools or a simple piece of JavaScript.
There also isn't really any reason for preventing those who have JavaScript disabled from accessing the page unless you are just too lazy to create a version of the page that will work for everyone. If you do want to drive those without JavaScript away from your page along with their friends and their friends then a simple "Go Away you are not welcome here" message in place of the content of your site will effectively produce the same end result (except slightly quicker). It is unlikely that anyone with CSS disabled will have JavaScript enabled. It is far more likely that someone will override your CSS and/or JavaScript with their own. You should only use document.write if you need to support Netscape 4 and earlier (although even by the time Netscape 4 was released it was considered extremely poor practice to have pages that don't work when JavaScript isn't available). The only sites where it makes sense to have pages that actually rely on JavaScript to work are those on sites that are actually about JavaScript and anyone visiting a site about JavaScript with JavaScript disabled or not available in their browser at all wouldn't be expecting all the script examples to work in their browser. Apart from animations, anything that can be done with JavaScript can also be done without it and the reason why a large number of people actually disable JavaScript is because they visit too many sites that have annoying animations. Those who don't have JavaScript enabled can be divided into two groups - those who are using a browser without JavaScript who therefore can't turn it on and those who have deliberately disabled it for a reason and who therefore will NOT turn it on just because some site owner was too lazy to set up their site properly to work without it. You may get away with a JavaScript only site if it is only intended for you and a few friends to use but you certainly can't get away with it for a business site (as one retailer discovered after being fined several million for not having a site that worked without JavaScript and which was therefore found to be discriminating against disabled people). |
:D
Quote:
When I Google for "Javascript discrimination" I get many links that tell me that I must have Javascript enabled to view them! :) Including The Gay and Lesbian Rights Lobby. :D Edit: Researching, I find that in 2000, an Australian blind man won a court case against the Sydney Organizing Committee of the Olympic Games (SOCOG). This was the first successful case under Disability Discrimination Act 1992 because SOCOG had failed to make their official website, Sydney Olympic Games, adequately accessible to blind users. Presumably he went on to sue book and newspaper publishers on the same grounds! :D I rather think that Javascript or lack of it was not an issue in this case. I suspect that he was not totally blind, but visually impaired, perhaps colour-blind. IMHO people who deliberately disable Javascript in their browsers (a tiny minority surely?) must know perfectly well what they are doing, and should be prepared to accept the consequences. Same with those who insist on clinging to Netscape 4! If I disable Javascript in my browser that does not somehow make me disabled. |
Quote:
The Gay and Lesbian Rights Lobby is not a business and so would not be subject to the rules regarding preventing people with disabilities from being allowed to buy products from them. Studies have shown that over 70% of web users are disabled in some way although most of the disabilities are so minor that they can be compensated for by simple things such as zooming pages to make the text big enough to read or overriding the stylesheet with one that doesn't use the colours that the person cannot distinguish between. Somewhere between 6 and 10% of web users have JavaScript disabled. In some cases it is because the browser or web reader being used doesn't support JavaScript. More common perhaps is all the people who have got fed up with ad after ad after ad after ad and silly animation after silly animation and who have therefore deliberately turned it off to get rid of all the garbage. The more knowledgeable of those have their browser set so that JavaScript is only enabled on those sites they regularly visit where the script actually serves a useful purpose (this the statistics show they have it disabled but they actually have it enabled for some sites). You can get away with a site that doesn't work without JavaScript providing that you are not a business selling to the public. For a business there is the risk of being sued (assuming that the people without JavaScript along with their friends and their friend's friends don't simply switch to buying from the competition. For other sites requiring JavaScript simply means that you have instantly lost at least 6% of potential visitors and possibly several times that (depending on how many friends those who can't use the site have and how widely the message that the site is a heap of excrement actually spreads). After all for almost any web site there are dozens of alternative sites some of which will work without JavaScript that everyone can use instead of the one that is broken for some visitors. |
This post is redundent as I read the above one :P How can I delete my posts?
|
Quote:
now let me be clear: it is possible to reduce accessibility with javascript. many widgets are not keyboard-navigable as are navs that use jQuery().hover(), client-side redirects, harsh validation, and others gotchas. That being said, as far as content goes, ajax injecting new static content is just as or more accessible than "regular" pages. <video> pumping captions to a div for screen-reader announcement is far more accessible than flash captions inside a black-box. ARIA form and control states provide a lot more info to AT than CSS, but they need javascript to be updated after page-load. Often, javascript is used to replace plug-ins with poor accessibility, and that's a clear win for accessibility. Just like HTML, javascript is a tool that can build something accessible or inaccessible, it depends on how it's used. There is nothing intrinsically inaccessible about javascript itself. |
Quote:
1) You are telling a blatant lie. or 2) You are displaying your incompetancy by not getting your facts straight first before posting or 3) My legal adviser at the ATO has been lying to me when he informed me that I am under no legal obligation to provide full functionality to javascript disabled browsers and that I am not liable in any way to users with javascript disabled. I seem to recall that you made similar comments/generalisations on another website. I have sent a copy of your posts, name and contact details to my legal adviser and asked him to investigate if what you say is true for my particular case and if not, to take what ever legal action he feels is appropriate. |
Look who’s chiming in! Long time, no see, bullant. ;)
Anyway, in response to Philip M’s opinion: Quote:
OK, it might be very low in percentage, and hits are not equal to unique visitors (one visitor can make several hits, or several hits can come from one visitor only, respectively) but shows that it’s certainly possible that people browse without JS. I don’t see any reason to exclude them, especially when it’s not a lot of additional effort to provide proper accessibility. |
[ot]
Quote:
[/ot] |
Quote:
Only where the client is prepared to pay for the extra effort should you be creating the JavaScript version. There is no legal obligation to create a web page at all. There is a legal obligation in some countries for business sites to ensure their site is usable for ALL their visitors. Mostly it is a matter of wanting people to actually visit the site and so you build it so that it functions for all visitors because that's the best way to avoid getting a reputation for creating garbage web sites. The only web site known to have been actually sued for it not working without JavaScript was the US store that settled out of court for a sum believed to be somewhere between 100,000 and 10,000,000. All other sites that require JavaScript usually just have everyone ignore that site and go to their competition instead. No one ever hears about them because no one bothers to visit them. There are also lots of people writing garbage that they think is JavaScript that actually makes the site harder to use - that's why so many people disable JavaScript. If all the JavaScript were actually written properly then there'd be no reason for anyone to disable it. It takes several years for even an experienced programmer to learn how to write JavaScript properly so most of what is written is better suited to Netscape 2 than it is to modern browsers. Just consider how much supposed JavaScript you see that contains any of the following long dead code: language="javascript" document.write document.all eval alert prompt navigator.userAgent any of those is a clear sign that the person who wrote the code has not learnt JavaScript but has just copied something that someone else wrote over 10 years ago. Anyway, your legal advisor can't force people to visit crap web sites so their opinion is irrelevant. |
| All times are GMT +1. The time now is 05:03 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.