I realize that javascript can detect if it's enabled simply by attempting to execute itself, and then you can supply a user who has no javascript available with content via <noscript> but I've always found it frustrating. Is there a better way to detect if the user has javascript enabled?
Code: Select all
var element = document.getElementById('element');
element.innerHTML = '<a href="javascript;" onclick="someFunction()">Click Here!</div>';
Code: Select all
<div id='element'>
<noscript><a href="you_are_a_loser.html">Click Here!</noscript>
</div>
The reason I am asking is that I want to have a link that if javascript is enabled, it executes a javascript function, otherwise, it goes to a page I specify...