Title: Implementing Javascript in Header.php
Last modified: August 22, 2016

---

# Implementing Javascript in Header.php

 *  [anpu](https://wordpress.org/support/users/anpu/)
 * (@anpu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/)
 * Hello Everyone,
 * In the header.php I have link that uses image mapping, it also uses a shortcode
   via a plug-in to display different content in the different times of the day 
   and the week in that same area. This link opens a “_blank” and let’s the visitor
   listen to a radio stream. The provider of this radio stream wanted to change 
   the link. Here we go:
 * They wanted me to add this to <HEAD>:
    `<script language=javascript src="http://
   nick8.surfernetwork.com/Media/player/scripts/launch.js"> </script>` … which is
   of course, simple. And the site runs fine with this in header.php.
 * However they wanted me to replace the link with this:
    `<a href="javascript:callLTR
   ='SGN';grptuner='';file='';title='';ListenLive();" target="_self"> Listen Live
   </a >` … this is part I having trouble with.
 * Currently what I have is:
 *     ```
       <?php echo do_shortcode('[timed onday="1" ontime="1500" offtime="1900"]<p class="smallbanner"><img src="http://www.sgnthelight.com/wp-content/uploads/2014/10/listenLive_TBMS.png" width="470" height="56" border="0" usemap="#smallbannermap" />
       <map name="smallbannermap" id="smallbannermap">
         <area shape="rect" coords="2,2,467,54" href="http://lightningstream.surfernetwork.com/Media/player/view/SGN_gsl.asp?StreamingServerName=nick11y&call=SGN&targetWidth=1000&targetHeight=800" target="_blank" />
       </map></p>[/timed]'); ?>
       ```
   
 * So, if I put the code in it, it becomes:
 *     ```
       <?php echo do_shortcode('[timed onday="1" ontime="1500" offtime="1900"]<p class="smallbanner"><img src="http://www.sgnthelight.com/wp-content/uploads/2014/10/listenLive_TBMS.png" width="470" height="56" border="0" usemap="#smallbannermap" />
       <map name="smallbannermap" id="smallbannermap">
         <area shape="rect" coords="2,2,467,54" href="javascript:callLTR='SGN';grptuner='';file='';title='';ListenLive();" target="_blank" />
       </map></p>[/timed]'); ?>
       ```
   
 * … and once this is implemented the site doesn’t even open, just a blank page 
   comes up.
 * Even though I know an imagemap won’t cause it I wanted to try it without that
   code anyways… so, I’ve reduced the code to work without image mapping… but still
   doesn’t work, I get the same blank page.
 * How can I make this happen? Thank you very much in advance.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [anpu](https://wordpress.org/support/users/anpu/)
 * (@anpu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/#post-5515357)
 * Can anyone help me with this please?
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/#post-5515401)
 * Looks like a syntax error. The single quote at the beginning of SGN unintentionally
   terminates the string to be echoed. You have to use \’ instead of ‘ to indicate
   a that a particular single quote is not a delimiter. Can’t comment on the logic.
 *  Thread Starter [anpu](https://wordpress.org/support/users/anpu/)
 * (@anpu)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/#post-5515403)
 * Thanks lorro.
 * I am not sure if it’s a syntax error; because I’ve tested if there is a syntax
   error or not by putting the code in that goes in to the <HEAD> then placed the
   second “link” code in to a post and it does bring up the page I need… it only
   acts up (as I described what it does before) when the link code is in the header.
   php. But are you saying if I use \’ instead of ‘ in the second link code it would
   work?
    Turning this one: `href="javascript:callLTR='SGN';grptuner='';file='';
   title='';ListenLive();"` into this: `href="javascript:callLTR=\'SGN\';grptuner
   ='';file='';title='';ListenLive();"` … correct? I’ve tried it in the header.php
   this way; the site still doesn’t come up when it’s in place. What do you think
   is going on?
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/#post-5515404)
 * Inside the do_shortcode () brackets, the first and the last ‘ are the delimiters
   of the overall text string. All the other ‘ inside the text string should be \’
   so they are not recognized as the delimiters.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Implementing Javascript in Header.php’ is closed to new replies.

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)
 * [href](https://wordpress.org/support/topic-tag/href/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [js](https://wordpress.org/support/topic-tag/js/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/implementing-java-in-headerphp/#post-5515404)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
