JavaScript weirdness

I was trying to setup a “Save This” link so visitors can easily save any article into their account. However, it didn’t work.

After checking on Firefox’s Javascript console, I saw this error message : “missing ) after argument list“, pointing to the encodeURIComponent() function. It must be me, because after I contacted support, they said they never encountered error like this before. I probably should have informed them that I’m using Firefox on Ubuntu, it might be specific to this configuration.

Anyway, the solution is to use these code instead :

<a href=”<?php rawurlencode(utf8_encode(the_permalink())) ?>&title=<?php rawurlencode(utf8_encode(the_title())) ?>” target=_blank><img src=””> Save This Page</a>

Hope it helps someone else out there.

1 thought on “JavaScript weirdness

Leave a Reply

Your email address will not be published. Required fields are marked *