Closed Bug 248909 Opened 20 years ago Closed 20 years ago

mozilla/firefox does not pull in external CSS

Categories

(Core :: CSS Parsing and Computation, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ektoric, Assigned: dbaron)

Details

(Keywords: testcase)

Attachments

(2 files, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

Mozilla/Firefox does not pull in external CSS styles.
A javascript generated page attempts to link in an external CSS style, but the
styles are not applied.
A javascript generated page uses an internal CSS style and works.
A static page links in an external CSS style and works.

Reproducible: Always
Steps to Reproduce:
1. Create a page that uses javascript to generate HTML that pulls in external CSS.
2. The javascript generated page does not pull in the external CSS.
3.

Actual Results:  
Browser default behavior (no CSS) is used instead of external CSS page that is
supposed to be linked in.

Expected Results:  
Link in external CSS, apply styles to page being rendered.

Code Snippets: 3 files - main.html, static.html, body.css, 
**********************************************************************
* main.html
**********************************************************************
<html><head>
<script language="JavaScript">
<!--
function writeHtmlExternal()
{
    var buf = "";
    buf += "<html><head>\n";
    buf += "<link rel='stylesheet' id='styleLink' href='body.css'
type='text/css'>\n";
    buf += '</head>\n';
    buf += "<body>";
    buf += "This should be blue! (external CSS)"
    buf +="</body></html>";
   return buf;
}
function writeHtmlInternal()
{
    var buf = "";
    buf += "<html><head>\n";
    buf += '<style type="text/css">\n';
    buf += 'body{ color: #0000FF; }\n';
    buf += '</style>\n';
    buf += '</head>\n';
    buf += "<body>";
    buf += "This should be blue! (internal CSS)"
    buf +="</body></html>";
    return buf;
}
//-->
</script>
</head>
<frameset rows="50,50,50" frameborder=yes border=2>
	<frame name="static" src="static.html">
	<frame name="extcss" src="javascript:parent.writeHtmlExternal()">
	<frame name="intcss" src="javascript:parent.writeHtmlInternal()">
</frameset>
<body>
</body><html>

**********************************************************************
* static.html
**********************************************************************
<html><head>
<link rel='stylesheet' id='styleLink' href='body.css' type='text/css'>
</head>
<body>
This should be blue! (static page)
</body></html>

**********************************************************************
* body.css
**********************************************************************
body{ color: #0000FF; }
Could you attach a testcase, or could you put somewhere else a testcase which
shows the bug?
Attached file sample test case (obsolete) —
Attached file same test case (obsolete) —
Attached file same test case CSS
Keywords: testcase
Verified in
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616
wfm Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040628
Attached file Working testcase (obsolete) —
You had an error in your testcases, you were still linking your stylesheet to
'body.css', but this has to be
'http://bugzilla.mozilla.org/attachment.cgi?id=151865&action=view' for the
stylesheet file (the mime type isn't right, but that doesn't matter in this
case).
This is a good testcase, but this one works fine for me.

I see you did work with a relatively linked stylesheet: <link href='body.css'.
The frame has src="javascript:", so the base url is 'javascript:', which seems
to me correct. But IE seems to use the location of the parent frameset as base
url instead. So I'm beginning to think this is correct behavior of Mozilla. If
you would like to include an external stylesheet in this case, you should use a
absolute url.
Attachment #151863 - Attachment is obsolete: true
Attachment #151864 - Attachment is obsolete: true
Oops, happening to me now also. The previous one was wrong. Sorry.
Attachment #151872 - Attachment is obsolete: true
Attachment #151865 - Attachment mime type: text/plain → text/css
Marking WORKSFORME. Please reopen if you still have this problem with attachment
151873. Thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: