I’m using the Bits-on-the-run API to upload videos using these instructions, the thing is I have to include the upload form into an iframe, the upload form will upload the video and after it finishes it will redirect to another page with the video id as a url variable.
What I’m trying to do is to get that url variable from the iframe when the upload finishes.
Here’s the iframe example:
<iframe width="650" scrolling="auto" height="220" frameborder="0" src="http://developer.longtailvideo.com/botr/demo/upload/"></iframe>
when the uplaod finishes, the iframe redirects to:
<iframe width="650" scrolling="auto" height="220" frameborder="0" src="http://developer.longtailvideo.com/botr/demo/upload/show.php?video_key=xxxxx"></iframe>
Such that xxxxx is the video key I want to extract in the parent page, I’ll use this video key in a hidden input in order to submit another form.
Is tehre a way I can get this url variable when the redirect happens?
Try this:
Timing is very important in this case because
ifr.contentWindowdoes not exist before it is first loaded. I suggest, that you first load a page from your server to theIFRAMEand then assign theonload-eventhandler from that page to the host page.Or you can wait untill the whole host page is loaded (
window.onload) and then assign the eventhandler forifr.contentWindow.