Post bookmarklet on wordpress.com

wordpress.com

I have a blog on wordpress.com and would like to post a bookmarklet I have written there. However, wordpress.com breaks the URL string. Is there any way I can post it?

For example, if I enter a link in HTML view as

<a href="javascript:alert('dog')">Hi</a>

when I press publish the link is changed to:

http://myblog.wordpress.com/alert(%27dog%27)

Best Answer

JavaScript is not allowed on wordpress.com blogs due to security reasons. This means that the following will not work (among others): <script> tags; javascript: links; and events such as onclick.

In fact, that's the reason I switched from wordpress.com to blogger.com. Your only Wordpress option is to either host it yourself, or find some hosting solution that allows JavaScript.

If you decide to host it yourself, JavaScript will work out of the box (tested on latest version only), and you can find more information here.

If for some reason you cannot use JavaScript with your hosting, you could try to see if it supports the Inline JavaScript Plugin [via], which will enable JavaScript. Wordpress.com does not support this plugin.