JavaScript weirdness

I was trying to setup a “Save This” link so visitors can easily save any article into their del.icio.us 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 del.icio.us support, they said they never encountered error like this before. I probably should have informed them that I’m using Firefox 1.5.0.7 on Ubuntu, it might be specific to this configuration.

Anyway, the solution is to use these code instead :

<a href=”http://del.icio.us/post?v=4&noui&jump=close&url=<?php rawurlencode(utf8_encode(the_permalink())) ?>&title=<?php rawurlencode(utf8_encode(the_title())) ?>” target=_blank><img src=”http://images.del.icio.us/static/img/delicious.small.gif”> Save This Page</a>

Hope it helps someone else out there.

One thought on “JavaScript weirdness

Leave a Reply

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