reply to post by harrytuttle
Though you're right about the hyperlink creator being clumsy with characters, the link tags "[]" are in fact invalid characters for URLs. The source
of the discrepancy of copying the URL from the address-bar yet yielding an invalid URL lies in the fact that browsers like to show human-readable
URLs. Characters that can't be used as-is are converted prior to sending them to the server, and vice-versa. This means that the end-user never gets
to see proper (and ugly) URLs. Therefore, it doesn't matter which characters are chosen for the tags for images and links; if browsers simply show all
characters in the address bar, then no character (or sequence of characters) can be used to consistently differentiate the end of the tag from a part
of the URL. Of course, this should only be a problem when typing tags manually (as I prefer); the hyperlink tool should use Javascript's encodeURI
function to ensure that URLs are valid. For details on URL encoding, see for example
this random google result on URL encoding.
An immediate though slightly annoying solution lies in converting the URL from your address bar to a proper URL manually (i.e. before entering it in
the hyperlink tool's prompt dialog). The page linked to above contains a tool at the bottom of the page which allows you to convert an address. Your
browser itself is also capable of doing so, for example through Javascript. You can for instance create a bookmark* containing the following code:
(remove the "_" in "_javascript")::
_javascript: alert ( encodeURI( prompt( "What is the URL you want to encode?" ) ) )
When you click this bookmark, a dialog will ask you for an URL, and hand you the encoded version in return.
Alternatively, you could make a bookmark out of this address:
_javascript: alert ( encodeURI( document.location ) )
This bookmark simply converts the URL currently in your address bar - skipping the dialog.
As an example, here is a link to the page in your OP:
Helioviewer. The characters
"[" and "]" have been replaced by "%5B" and "%5D", and the URL is now happily accepted.
There is not much we can do - I tried a number of times to suggest a specific change in Javascript code, but it's not at the top of the todo list, I
believe
. I hope one of these methods pleases you!
* Javascript bookmarks are technically no different from normal bookmarks; however, depending on your browser, you may not be able to bookmark the
code simply by entering it in the address-bar and bookmarking the page - even though you can execute the code simply by putting it in the address bar
and hitting enter. In case you're using Firefox, you can add a _javascript bookmark by Bookmarks -> Organize Bookmarks; then select the category you
want the bookmark to be placed in (for maximum ease, choose Bookmarks Toolbar); finally, right-click in the bookmark viewer (the area to the right),
click "New Bookmark", enter the _javascript code as "Location:", and choose a name (I went with "URLify"). You should be ready to go!
Unfortunately, I don't know how to achieve the same for Internet Explorer, though I expect it to be at least as easy.
edit on 13-3-2011 by
scraze because: code got stripped of alert's
edit on 13-3-2011 by scraze because: same problem
edit on 13-3-2011 by
scraze because: still trying..