Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 809871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:47:48+00:00 2026-05-15T00:47:48+00:00

I have two colorbox popup boxes which show a YouTube video in each. When

  • 0

I have two colorbox popup boxes which show a YouTube video in each. When they’re finished playing, I’m trying to have them automatically close the colorbox window. This code below works perfect in Firefox, but in IE I can’t get addEventListener to work. I’ve tried attachEvent with no success. Can anybody offer any suggestions as to how to solve this? It seems simple but I’m exhausted trying to find a solution.

UPDATE 1:

Well, this is my current code. It works perfect in Firefox, but IE only outputs good. IE8 debugger doesn’t report any errors either…

function onYouTubePlayerReady(playerId) {
  if (playerId && playerId != 'undefined') {
    if(playerId && playerId == 'ytvideo1'){
      var ytswf = document.getElementById('ytplayer1');
      alert('good');
    } else if(playerId && playerId == 'ytvideo2'){
      var ytswf = document.getElementById('ytplayer2');
    } else {
    }

    setInterval('', 1000);
    ytswf.addEventListener('onStateChange', 'onytplayerStateChange');
    alert('great');
  }
}


function onytplayerStateChange(newState) {
  alert('amazing');
  if(newState == 0){
    $.fn.colorbox.close();
    alert('perfect');
  }
}

Update 3: Solution

Simply put onComplete in my colorbox and put the swfobject in that and it worked perfectly in IE.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:47:49+00:00Added an answer on May 15, 2026 at 12:47 am

    from testing in IE it looks like the reference you are using

    ytswf = document.getElementById('ytplayer1');
    

    is assigned before the actual swf object is loaded, so IE thinks you are referring to a simple div element

    you need to run this code

    function onYouTubePlayerReady(playerId) {
      ytswf = document.getElementById("ytplayer1");
      ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
    }
    

    right after you call

    swfobject.embedSWF("http://www.youtube.com/v/SPWU-EiulRY?
    hl=en_US&hd=0&rel=0&fs=1&autoplay=1&enablejsapi=1&playerapiid=ytvideo1",
    "popupVideoContainer1", "853", "505", "8", null, null, params, atts);
    

    before you close out that $(function()

    and place var ytswf;
    right after the <script>
    instead of further down

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using COLORBOX (http://colorpowered.com/colorbox/). I have two different colorboxes on the page and they
I have two classes (MVC view model) which inherits from one abstract base class.
I have two columns say Main and Sub . (they can be of same
Have two IBOutlets which won't appear in File's Owner to connect to even though
I am trying to use colorbox with an upcoming responsive site. I don't have
I have a page which uses the jQuery Colorbox plugin. My JS for the
We have two servers in the same network. One of them is the server
I have two BizTalk 2010 servers that belong to the same BizTalk group. They
I have an ASP.NET MVC application and I am using two JQuery plugins: colorbox
I have two applications written in Java that communicate with each other using XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.