How to generate different links on web page if JavaScript is enabled? -
I'm trying to follow incredible javascript / beautiful degradation tecnhique. When JavaScript is turned on, and when Javascript is off I want to serve the page with various links.
For example, when javascript is closed,
and when Javascript is on
(or something like that).
Both versions of the link (with JavaScript and without javascript) lead to server side scripts, but with different standards. The version that Javascript is switched on, it says the version that performs more on the server, so it would be unproductive to detect JavaScript (such as the non-JavaScript script from the server script to the other version in the window. Location
).
Note: I would prefer the solution without using javascript libraries / framework like jQuery.
Good, the answer is to present the page in normal form with non-JavaScript links. Then get javascript to change the link with js = 1 versions.
var links = document.getElementsByTagName ('a'); (Var i = 0; i & lt; links.length; i ++) {link [i] .href + = "; js = 1"; }
Comments
Post a Comment