Title: Java Script Being Ignored By WP?
Last modified: August 21, 2016

---

# Java Script Being Ignored By WP?

 *  [lordklp](https://wordpress.org/support/users/lordklp/)
 * (@lordklp)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/)
 * I built a basic HTML webpage, on my PC to test a Script that will display an 
   IP Camera feed on a webpage. I saved the file as index.html, and opened it. Sure
   enough i saw the camera feed as was expected.
 * I then went into my wp-admin, and created a new page called ‘Live Stream’, i 
   went to edit the page using the ‘TEXT’ view and copied the script into the page,
   saved and published it.
 * However, when i go to the this page on the internet….i see nothing, no stream,
   its as if the script is being ignored.
 * Any help would be greatly appreciated.

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551248)
 * Have you reviewed [Using_Javascript](http://codex.wordpress.org/Using_Javascript)?
 *  Thread Starter [lordklp](https://wordpress.org/support/users/lordklp/)
 * (@lordklp)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551250)
 * Hi esmi, Yes, it seems to indicate that for one off uses, writing the code between
   <script> and </script> using the text editor should work, however it doesn’t.
   The code is actually fairly straightforward too :
 *     ```
       <SCRIPT LANGUAGE="JavaScript">
       // Set the BaseURL to the URL of your camera
       var BaseURL = "http://ymaes.axiscam.net/";
   
       // DisplayWidth & DisplayHeight specifies the displayed width & height of the image.
       // You may change these numbers, the effect will be a stretched or a shrunk image
       var DisplayWidth = "320";
       var DisplayHeight = "240";
   
       // This is the path to the image generating file inside the camera itself
       var File = "axis-cgi/mjpg/video.cgi?resolution=320x240";
       // No changes required below this point
       var output = "";
       if ((navigator.appName == "Microsoft Internet Explorer") &&
          (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k"))
       {
         // If Internet Explorer under Windows then use ActiveX
         output  = '<OBJECT ID="Player" width='
         output += DisplayWidth;
         output += ' height=';
         output += DisplayHeight;
         output += ' CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
         output += 'CODEBASE="';
         output += BaseURL;
         output += 'activex/AMC.cab#version=4,1,4,0">';
         output += '<PARAM NAME="MediaURL" VALUE="';
         output += BaseURL;
         output += File + '">';
         output += '<param name="MediaType" value="mjpeg-unicast">';
         output += '<param name="ShowStatusBar" value="0">';
         output += '<param name="ShowToolbar" value="0">';
         output += '<param name="AutoStart" value="1">';
         output += '<param name="StretchToFit" value="1">';
         output += '<B>Axis Media Control</B>';
         output += 'The AXIS Media Control, which enables you ';
         output += 'to view live image streams in Microsoft Internet';
         output += ' Explorer, could not be registered on your computer.';
         output += '</OBJECT>';
       } else {
         // If not IE for Windows use the browser itself to display
         theDate = new Date();
         output  = '<IMG SRC="';
         output += BaseURL;
         output += File;
         output += '&dummy=' + theDate.getTime().toString(10);
         output += '" HEIGHT="';
         output += DisplayHeight;
         output += '" WIDTH="';
         output += DisplayWidth;
         output += '" ALT="Camera Image">';
       }
       document.write(output);
       document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen"
   
       // Remove the // below to use the code for Motion Detection.
         // document.Player.UIMode = "MDConfig";
         // document.Player.MotionConfigURL = "/axis-cgi/operator/param.cgi?ImageSource=0"
         // document.Player.MotionDataURL = "/axis-cgi/motion/motiondata.cgi";
       </SCRIPT>
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551252)
 * > However, when i go to the this page on the internet….i see nothing, no stream,
   > its as if the script is being ignored.
 * Have you checked your browser’s console log for anything more informative?
    _
   [https://developers.google.com/chrome-developer-tools/docs/console](https://developers.google.com/chrome-developer-tools/docs/console)_
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551255)
 * You need to enqueue this script correctly.
 *  [webbrewers](https://wordpress.org/support/users/webbrewers/)
 * (@webbrewers)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551257)
 * When you look at the source code, is it being output as you’d expect?
 *  Thread Starter [lordklp](https://wordpress.org/support/users/lordklp/)
 * (@lordklp)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551267)
 * Hi esmi,
 * What do you mean by enqueue the script correctly?
 * Andrew Nevins : When viewing the page, and using the console, two ‘errors’ appear:
 * Uncaught SyntaxError: Unexpected token < [http://www.ymaescafe.co.uk/:143](http://www.ymaescafe.co.uk/:143)
 * event.returnValue is deprecated. Please use the standard event.preventDefault()
   instead.
 * Webbrewers : Yes, the source code output is as expected i.e. its the same in 
   WP as it was in the basic index page i created to test the script.
 *  [webbrewers](https://wordpress.org/support/users/webbrewers/)
 * (@webbrewers)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551284)
 * Since you “moved” the code, are you sure the path to the file and permissions
   are correct?
    `var File = "axis-cgi/mjpg/video.cgi?resolution=320x240";`
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551319)
 * > What do you mean by enqueue the script correctly?
 * Have a look at [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)

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

The topic ‘Java Script Being Ignored By WP?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 4 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/java-script-being-ignored-by-wp/#post-4551319)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
