This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19492 - Javascript URI Consumption and Composition
Summary: Javascript URI Consumption and Composition
Status: RESOLVED DUPLICATE of bug 13720
Alias: None
Product: WHATWG
Classification: Unclassified
Component: URL (show other bugs)
Version: unspecified
Hardware: PC Windows 3.1
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+urlspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-12 03:05 UTC by Michael A. Puls II
Modified: 2013-11-21 12:59 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael A. Puls II 2012-10-12 03:05:31 UTC
Not sure if these will help with your Javascript URI research, but here it is anyway:
 
Create Javascript URIs:
<http://shadow2531.com/js/jsuri.html>
<http://shadow2531.com/js/jsuri.js> (that jsuri.html uses)
 
It does two things to the JS code you type:
 
* Normalizes newlines to \r\n.
 
* UTF-8-percent-encodes the code (using encodeURIComponent() on UTF-8 page).
 
That's basically how you properly-encode a Javascript URI (for bookmarklet or other use).
 
The percent-encoding is very important as browsers always percent-decode first and if you have %HH is URIs in JS code literal strings for example, they will be damaged when the browser percent-decodes the Javascript URI before it's executed.
 
'#' isn't special in Javascript URIs. They're treated as just '#' by browsers (not necessarily the URI parser though, but the end result).
 
Also, I haven't messed with these in a long time, but I once played around with creating a JS Javascript URI handling library.
 
<http://shadow2531.com/js/javascript_uri_tools.js>
<http://shadow2531.com/js/javascript_uri_tools.html>
<http://shadow2531.com/js/js_uri_tools.js>
 
getLiteralCodeStringFromURI() in js_uri_tools.js might be of interest from a consumption standpoint. (The URI isn't parsed with a URI parser to get the JS code for example as a URI parser isn't needed.)
Comment 2 Anne 2013-11-21 12:59:17 UTC
This is HTML's problem now.

*** This bug has been marked as a duplicate of bug 13720 ***