Support » Fixing WordPress » Problem with bookmarklet – JavaScript in href inside <a> tag

  • I was blogging about some bookmarkets I like and I was trying to procide links so that my readers could save them too.

    I noted a problem with some of the links I provided. At first I thought it only happens with bookmarklets that have an URL insite HREF, as the links get truncated when published. But then I noticed it happens with any bookmarklet that has an URL inside single quotes.

    For example:

    The bookmarklet from is


    And this one from, a Brazilian URL shortener:


    Both of them have an URL inside single quotes. When you write the link, the code will look like this:

    <a href="javascript:void(location.href=''+escape(location.href));"></a>

    So, it’ll have a javascript code between double quotes with an URL between single quotes in it.

    The problem is that when I publish it, the SECOND SINGLE QUOTE is automatically changed by a DOUBLE QUOTE. So, when hovering through the link, I have only:

    <a href="javascript:void(location.href='

    Of course it doesen’t work.

    Am I doing something wrong? I didn’t do this bookmarklets myself, just copied them from their websites. Is there any way around this?

    Thanks a lot. I’m already VERY tired of googling for this since last night.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with bookmarklet – JavaScript in href inside <a> tag’ is closed to new replies.