Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

noscript tag appears even if javascript is turned on in IE8

ghost noscript tag more info here
I am facing exactly this issue, how shall I handle this for Internet Explorer browsers :-( ?

Explanation:
I have included the following noscript tag in my application's layout

<noscript style="background:#ffcc00;font-size:200%;font-family:verdana;text-align:center;text-transform:uppercase;font-weight:bold;padding:0.8em;">javascript is disabled, please enable it first.</noscript>

Now when I view this layout in IE8 the noscript tag CSS is displaying at the top of the page without the content in it, making the layout look faulty.

Please help...

like image 495
Gaurav Sharma Avatar asked May 26 '10 10:05

Gaurav Sharma


People also ask

Does noscript tag prevent JavaScript?

Anything within < noscript>< /noscript> tags will render only when JavaScript is disabled . Users might disable JavaScript for a number of reasons. A handful of people even install browser extensions like NoScript to prevent the browser from running JavaScript.

What is the purpose of noscript tag in JavaScript?

<noscript>: The Noscript element The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.

What is the purpose of the noscript tag in JavaScript chegg?

Usage of NoScript tag: The tag defines alternate content that will be displayed if the user has disabled script or browser does not support script. It can be used inside both <head> and <body> tag.

Does noscript works even with browsers that don't recognize the noscript tag?

The <noscript> tag in HTML is used to display the text for those browsers which does not support script tag or the browsers disable the script by the user. This tag is used in both <head> and <body> tag. Note: This tag is used in those browsers only which does not support scripts.


1 Answers

Don't style the noscript tag, put the content inside another tag:

<style>
#js-warning p {
    background:#ffcc00;
    font-size:200%;
    font-family:verdana;
    text-align:center;
    text-transform:uppercase;
    font-weight:bold;
    padding:0.8em;
}
</style>

<noscript id="js-warning">
<p>Javascript is disabled, please enable it first.</p>
</noscript>
like image 148
roryf Avatar answered Sep 22 '22 00:09

roryf