I'm using Javascript, ASP.net and C#. I want to write a custom control to check if Javascript is enabled on the browser and display a message. I'm using the following approach:
the control shows a message "Javascript disable" in a
<div>tagthe control adds in the section a Javascript section with this line:
window.onload = function() {{document.getElementById('My_MESSAGE_DIV').style.display = 'none';}}
The problem is the following:
when Javascipt is enabled the onload event is fired when the page is already displayed so the message "Javascript disable" appears on the page and disappear immediately, I would like to avoid this!
Any suggestion?
Possible solution:
- find an event that get fired before the document is displayed. Any suggestions?