NoScript blocks my CSS -- how to fix?

Ask for help about NoScript, no registration needed to post
long time user

NoScript blocks my CSS -- how to fix?

Post by long time user »

Some CSS I was writing began failing today in FireFox when the NoScript add-on was active (meaning that it disallows the site hosting the page). Below is a snippet that shows the problem--this HTML validates at http://validator.w3.org/check

When the class "ie6" is not included on the 2nd line, as shown below, what I see in FireFox are the two hyperlinks "Mozilla Firefox" and "Google Chrome" below the heading text "Firefox Link Fail". I was expecting that the entire div would be hidden. Inspecting with FireBug shows that the two links have been repeated outside the div block.

Is there a workaround for this, or can you fix it?
Thank you,

Code: Select all

<!DOCTYPE html>
<html class="no-js">
<head>
<title>Firefox Link Fail</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<style type="text/css">

     .ie6-upgrade  { display: none; }
.ie6 .ie6-upgrade  { display: block; }

.ie6-message {
   background:#4a4a4a;
   color: #fff;
   padding: 5px;
   width:100%;
}
.ie6-message a {
   color: #fff;
}
</style>
</head>
<body>

<div class="ie6-upgrade ie6-message">
   <strong>Note</strong>: Blah, blah, consider using a modern browser such as
   <!-- With NoScript active, these links are displayed in Firefox AFTER the h2 below -->
   <a href="http://www.getfirefox.com/">Mozilla Firefox</a> or
   <a href="http://www.google.com/chrome/">Google Chrome</a>.
</div>

<h2>Firefox Link Fail</h2>
</body>
</html>
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15
long time user

Re: NoScript blocks my CSS -- how to fix?

Post by long time user »

Sorry, that would be FireFox 3.6.13 on WinXP, and FireFox 3.6.15 on Ubuntu using NoScript 2.0.9.9
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: NoScript blocks my CSS -- how to fix?

Post by Giorgio Maone »

Just add a link outside the .ie6 section (any link with a width greater than 0 will do -- if you want it to be hidden, just make its opacity = 0).
Having two invisible links and no visible one a scriptless page triggers a NoScript accessibility enhancement, which makes them visible (by duplication) assuming they would be shown through scripts.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
long time user

Re: NoScript blocks my CSS -- how to fix?

Post by long time user »

Okay, got it. Thank you.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15
Post Reply