Closed Bug 61019 Opened 25 years ago Closed 21 years ago

javascript:StringExpression doesn't work as the url of a style sheet

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: erik, Unassigned)

References

Details

Attachments

(1 file)

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; COM+ 1.0.2204) BuildID: 20001120 It seems like the javascript: protocol is not fully implemented. It appears as there has only been hacks done for some special cases and it does not work in general. The same error applies to the about: protocol. Reproducible: Always Steps to Reproduce: 1. Set the src or the href to a javascript:stringExpression (or about:string) on an element that supports plain text files such as script tags, link tag, object elements... Actual Results: Nothing Expected Results: The expression should be evaluated and the browser should behave exactly as if it loaded a file with the same content as the value of the expression. This should probably also be targeted the js group and XP whatever group. All this is working in both IE5 and NN4.
about:<html> was an IE-only hack that didn't work for many strings (including "blank" and "mozilla"). Use data:text/html,yourhtml instead for link hrefs, and data:application/x-javascript,yourjs for script srcs. It's not clear to me how you're using javascript: as the src for a script tag. <script src="javascript:'alert(5)'"></script> works fine for me... Can you make sure that the problem still exists in a newer Mozilla build and then attach examples of things that doesn't work correctly in Mozilla?
I guess I wasn't clear enough. I'll write a few lines of code. These work: <script src="javascript:'alert(\'ok\')'"></script> <iframe src="javascript:'ok'"></iframe> but these do not: <link type="text/css" href="javascript:'span { color: red; }'" rel="stylesheet"> @import url("javascript:'span { font-weight: bold; }'"); -moz-binding: url('javascript:...')
to js component.
Assignee: gagan → rogerl
Component: Networking → Javascript Engine
QA Contact: tever → pschwartau
Browser, not Engine. Reassigning to DOM Level 0 for futher triage -
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
Yeah well, not critical for now, --> Future.
Severity: major → normal
OS: Windows NT → All
Hardware: PC → All
Target Milestone: --- → Future
there is bug 33961 for pseudo-urls : url("javascript: ...")
Depends on: 33961
To work around this bug, you can the data: protocol instead: <link rel="stylesheet" type="text/css" href="data:text/css,* { color: red; }">
Summary: javascript: and about: protocol not working → javascript:StringExpression doesn't work as the url of a style sheet
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
The first two "not working" testcases in comment 2 work for me. The third one is not this bug, but bug 33961. So marking worksforme. Will attach verifying testcase in a second.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
Attached file Testcase
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: