[Yulup] Relative URL fixup
Andreas Wuest
awuest at student.ethz.ch
Wed Feb 7 11:50:00 CET 2007
Hi
On 6.2.2007 4:38 Uhr, rickie dickie wrote:
> Could relative URLS be fixed-up when HTML is pasted into the editor?
> The elements that should be fixed are A and IMG from a copy/paste, in
> addition to SCRIPT, LINK and IMPORT when directly opening a file.
>
> A quick way of seeing this done is to use the earea editor, which gives you
> an editable page using your browser's native editing capabilities:
> http://www.sony-youth.com/software/eArea/eArea/blank.html?style=font:%20normal%2010px%20Verdana,%20Sans-serif;%20text-align:%20left;
>
> <http://www.sony-youth.com/software/eArea/eArea/blank.html?style=font:%2520normal%252010px%2520Verdana,%2520Sans-serif;%2520text-align:%2520left;>
>
>
> Now copy and paste into the earea editor a web page that has relative URLS,
> such as http://www.wikio.com/. <http://www.wikio.com/>
>
> You'll see these elements:
>
> - <img src="/shared/gui/wikio/mywikio.gif" border="0" style="margin:0px"
> width= "130"/></a>
> - <a href="/?actu=1" style="padding: 0px;margin: 0px;">
>
> If you select the same and paste into the earea edit page (and most other
> wysiwyg web-based editors), you will see the elements fixed up:
>
> - <img src=" http://www.wikio.com//shared/gui/wikio/mywikio.gif"
> border="0" style="margin:0px" width= "130"/></a>
> - <a href=" http://www.wikio.com/?actu=1" style= "padding: 0px;margin:
> 0px;">
>
>
> In addition, styles with url parameters could also be fixed up, such as
>
> - <div class= "comments" noWrap="true" style="background-image:
> url(/shared/gui/colors/comrb.gif);" >
I am not sure I understand you correctly. Basically, the goal is to keep
as many URIs as possible relative, so rewriting them to absolute URIs is
a Bad Thing (TM) IMHO.
Also, it is not clear how the rewriting should work. For example:
source element: <a href="../foo/bar.xhtml">Bar</a>
How should this be handled? Simply prepending the domain part of the
edited document base URI would result in <a
href=http://www.example.com/../foo/bar.xhtml">Bar</a>.
We could of course simply prepend the the URI of the edited document
minus the document name itself, e.g. <a
href="http://www.example.com/some/documents/../foo/bar.xhtml>Bar</a>.
But, as I've said above, this is generally not what you want, because
you can't guarantee that the rewritten link is actually valid (ok, you
can never guarantee that, rewriting or not), and coercing relative URIs
to absolute URIs is not a good idea.
Also, there's the question of how to integrate that into the UI. If you
have a good suggestion on how to do it, I would be glad to hear it! :)
--
Kind regards,
Andi
More information about the Yulup
mailing list