Troubleshooting a redirect after a video
This script should play a video then redirect to another page.
The video portion loads and plays automatically. The redirect feature does not work after the video finishes playing. The code is below:
<video src="http://brigadapictures.com/images/image1.m4v" autoplay height="396" width="704">
video>
var listenToMe:Object = new Object();
listenToMe.complete = fun开发者_如何学Pythonction(evt) {
getURL("http://brigadapictures.com/Home.html");
}
myMediaPlayer.addEventListener("complete",listenToMe);
which Mediaplayer lib do you use? Does the player run into your complete event? If it does, try the following code, instead of getURL("http://brigadapictures.com/Home.html");
location.href = 'http://brigadapictures.com/Home.html';
BTW: in IE, you have to use attachEvent, instead of addEventListener.
https://developer.mozilla.org/en/DOM/element.addEventListener#Internet_Explorer
精彩评论