SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot moretea's Avatar
    Join Date
    Jun 2004
    Location
    Texas, USA
    Posts
    118
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Question Effect of server and/or CMS on JavaScript execution?

    This is utterly wacky, and I can't figure out what the problem is. I have JS that plays a video, either natively in HTML5 or via a .SWF in older browsers. It works fine when served from my local machine (Apache 2.x on Mac OS X Lion), but when I check the code in to our company CMS and compile it in Tomcat, the JavaScript throws an error! The error is "Object does not support this method", and it happens when running the playVideo method on a video object (see code below).

    Code JavaScript:
                play.title = 'Play';
                play.className = 'video-button video-play';
                play.onclick = function() {
                    if ($(video).is('#flashObject')){
                        if (play.title === "Play"){
                            video.playVideo();
                            play.title = 'Pause';
                            // Additional class names for container and button while playing
                            root.className += ' video-on';
                            play.className += ' video-play-on';
                        } else {
                            video.pauseVideo();
                            play.title = 'Play';
                            // Remove additional class names for container and button in paused state
                            root.className = root.className.replace( ' video-on', '' );
                            play.className = play.className.replace( ' video-play-on', '' );
                        }
                    } else { ...

    BTW, this is happening specifically in IE8; I suspect IE7 will throw the same error. How can this be happening with client-side code??? Any ideas? Thanks in advance for your input!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    That error will occur when you try to access a property or method of an undefined object.

    If you can provide a test page that demonstrates the problem, we can use developer tools to pinpoint the precise location of the issue.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot moretea's Avatar
    Join Date
    Jun 2004
    Location
    Texas, USA
    Posts
    118
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I found what the problem was; I had forgotten to check one last .SWF file into our CMS. </me slaps forehead>


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •