Closed Bug 279338 Opened 20 years ago Closed 19 years ago

Alternate CSS file will not load if title attribute set, used in creating printer friendly pages

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 223410

People

(Reporter: stephen.yeargin, Assigned: bugzilla)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

A problem that has existed for quite some time, and Web designers have used the
easy workaround of simply removing the title attribute from an imported
stylesheet. However, as standards compliant code becomes more widespread, this
issue is one that must be addressed in future releases.

Reproducible: Always

Steps to Reproduce:
1. Open a page with an alternate stylesheet set with `media="print"` and a where
the title attribute is also set in both IE and Firefox
2. Internet Explorer will load the page as expected, Firefox will not load the
alternate stylesheet.
3. Removing the title attribute allows the stylesheet to load.

Actual Results:  
Browser unable to load alternate media stylesheet on a W3C-compliant page. This
usually results in areas that were meant to be hidden making it to the printed page.

Expected Results:  
Applied the attributes specified in the alternate stylesheet (`media="print"`),
hiding such things as footers and menu bars that are irrelevant on the printed page.

No special configuration, results can be verified by printing the page or simply
running "print preview."
I have nothing new to add except to confirm what Mr. Yeargin has reported. I
have experienced the same thing ever since pre-Firefox days.  It happens with
any type of alternate stylesheet, and is reproducable every time, in most or all
Gecko-based browsers.

As a web developer, it is very important to be able to let alternate stylesheets
do what they are meant to do, especially since we have coded according to W3C
standards.  Let the non-standard designers get punished, not us. :-)
Why is this a problem?  And which W3C standard are you referring to?  Moz simply
expects the printer sheet to be persistent.  Add another <link> tag, they're
free and extremely useful things. :-)

Example: (designer, user, browser, and standard friendly)
<link rel="stylesheet" href="print_friendly.css" type="text/css" media="print">
 // Persistent: Looks nice and saves on colour ink.

<link rel="stylesheet" title="My favorite" href="best_on_screen.css"
type="text/css" media="screen">  
// Preferred: because we title= it; appears first in the style menu because of
source order.

<link rel="alternate stylesheet" title="Simple styles (same as Print)"
href="print_friendly.css" type="text/css" media="all"> 
// Alternate: could also work nicely (in theory) on cell phones, TV, aural,
braille readers...

<link rel="stylesheet" href="always_load_this.css" type="text/css">  
// Persistent: Shh...and don't tell the user. ;-)

See Bug 223410 and the examples at
http://www.w3.org/TR/html401/present/styles.html#h-14.3.2
Another comfirmation of this behavior. Firefox should apply the style even with
the presence of a title attribute.
It should be noted that this breaks Firefox even when the stylesheet is not set
as an alternative.

<link rel="stylesheet" type="text/css" href="tutorial-print.css" title="print"
media="print" /> will break the functionality.
another confirmation, I too have this problem, when trying to generate a printer
friendly alternate stylesheet, with title= specified

<link rel="stylesheet" type="text/css" href="website.css" title="Default SS"
media="screen" />
<link rel="stylesheet" type="text/css" href="website-print.css" title="Print SS"
media="print" />

the above print stylesheet doesn't get applied when prinint the page (or viewing
in print preview)

withouth the title=... attributes it does work.
I'm also having the same problem.

<link rel="stylesheet" type="text/css" href="../css/mainprint.css" title="print"
media="print" />

does not work whereas

<link rel="stylesheet" type="text/css" href="../css/mainprint.css" media="print" />

does work.

But it's even worse than that. If the print style sheet is first in a list,
Firefox ignores the other style sheets.

<link rel="stylesheet" type="text/css" href="../css/mainprint.css" title="print"
media="print" />
<link rel="stylesheet" type="text/css" href="../css/main.css" title="main"
media="screen" />
<link rel="stylesheet" type="text/css" href="../css/handheld.css"
title="handheld" media="handheld" />
<link rel="alternate stylesheet" type="text/css" href="../css/main1.css"
title="main1" media="screen" />

This causes the main style sheet to not be rendered. If I move the "print" style
sheet to the bottom of the list, the main.css style sheet is rendered.
Clarification of the previous comment. If I move the "print" style
sheet to the bottom of the list without the title attribute, the main.css style
sheet is rendered.

*** This bug has been marked as a duplicate of 223410 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.