J
John Nagle
Is there any standard way to convert a relative URL to an absolute URL?
Obviously the browser knows how to do this. But doing it in Javascript
requires getting the document URL, parsing it, looking for a BASE element,
parsing that, taking in the URL to be made absolute, parsing that,
and then handling all the special cases while reassembling the parts.
Python's URLparse module has all the machinery for this. It is
several hundred lines of code, and I recently had to fix a bug in it.
I'd prefer not to have to translate that to Javascript, especially
since it's not very efficient and I need to apply it to all the links
on a page.
Somebody must have done this, but I'm not finding anything useful with Google.
John Nagle
Obviously the browser knows how to do this. But doing it in Javascript
requires getting the document URL, parsing it, looking for a BASE element,
parsing that, taking in the URL to be made absolute, parsing that,
and then handling all the special cases while reassembling the parts.
Python's URLparse module has all the machinery for this. It is
several hundred lines of code, and I recently had to fix a bug in it.
I'd prefer not to have to translate that to Javascript, especially
since it's not very efficient and I need to apply it to all the links
on a page.
Somebody must have done this, but I'm not finding anything useful with Google.
John Nagle