I am currently working with a combination of Javascript, ASP.net, and C# for my project. My goal is to create a custom control that checks if Javascript is enabled in the user's browser and displays a message accordingly. Here is the approach I have taken:
The control will display a message saying "Javascript disabled" within a
<div>
tag.The control will also include a Javascript section in the section with the following line:
window.onload = function() {{document.getElementById('My_MESSAGE_DIV').style.display = 'none';}}
The issue I am facing is as follows: when Javascript is enabled, the onload
event is triggered after the page has already been displayed, causing the "Javascript disabled" message to briefly appear and disappear immediately. I would like to find a way to prevent this from happening! Any suggestions?
Potential Solution:
- Discover an event that is triggered before the document is displayed. Do you have any recommendations?