How to use Javascript in Link – Link Manager

  • I’m trying to add a new link to my links manager, but when I put something like “javascript:someFunction()” in the web address field, the manager automatically disregards what I entered. I’ve figured out that the manager only allows you to enter strings with a valid protocol (ie. ‘http’, ‘https’, ‘ftp, etc…). I was able to get pass that by editing the “esc_url” function in the “formatting.php” file. This allowed me to save the link with the desired script entered in the web address field, but now when I try and use that link, wordpress inserts a ‘#’ in for ‘href’ attribute instead of my script. Anyone have any ideas on how to circumvent this issue?
    Thanks,
    Anthony

  • You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.

    If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

  • You are posting to the wrong support forum and we cannot help you here at WordPress.COM. Please post to the correct forum for your software here > http://wordpress.ORG/support/

  • I’m sorry, I am a member, and here is my site. I just forgot to include it.
    beaversholdings.wordpress.com
    Sorry about that!

  • Then the reason you can’t use javascript is that on WP.com it’s stripped out for security reasons.

  • Should have refreshed.

    G’day Raincoaster.

  • I was able to get pass that by editing the “esc_url” function in the “formatting.php” file.

    The blog linked to your name is 2 years old and completely empty so that is not the blog you are talking about – also see the quote above where you are into a php file – you can’t edit a php file here – so you are still in the wrong forum – you need to make friends over at WordPress.ORG – read the links give by the friendly supportbot

  • The topic ‘How to use Javascript in Link – Link Manager’ is closed to new replies.