Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE6 problem: JS to dynamicly create a page holding flash object.

Status
Not open for further replies.

helinga

Programmer
Jun 10, 2008
3
BG
Hi there,

I have this simple code which basically creates a new window holding a video player via SWFobject. The new window is created when the user click on a certain button on a flash interface so I use getURL() function.

The code works mint on FF, Opera but under IE6 the window doesn't open at all.

------------------
getURL("javascript:win=window.open('','newWin','width=512,height=384,left=50,top=50,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes,fullscreen=no');win.focus();void(0);win.document.write(%22<HTML><TITLE>Video Preview</TITLE><BODY leftmargin='0' topmargin='0' bgcolor='black'><div id='container'><a href=' color=white>Get the latest Flash Player to see this video.</a></font></div><script type='text/javascript' src='js/swfobject.js'></script><script type='text/javascript'>var s1 = new SWFObject('mediaplayer.swf','mediaplayer','512','384','7');s1.addParam('allowfullscreen','true');s1.addVariable('width','512');s1.addVariable('height','384');s1.addVariable('autostart','true');s1.addVariable('file','"+escape(big.video)+"');s1.write('container');</script></BODY></HTML>%22);", "_self");
------------------

note: escape(big.video) is the escape code value of the var big.video which holds an URL to a movie (basically the file that must be played).



I tried all kinds of things to make it work under IE6 - Using standard <object> tag for example instead SWFobject. I'm pretty sure that the code 'breaks' only when - mediaplayer.swf is accessed. Maybe some sort of protection? Anybody have any idea what may be causing this?

Thanks
L. Ivanov.
 
What does 'getURL' do? Why do you need to wrap all that JS in a call to it? Does it work without the 'getURL' call?

P.S. 'font' tags are deprecated and have been for some time. Consider using CSS instead.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi BillyRayPreachersSon,

getURL is a standart flash function. I has to be there in this case so that flash can execute JS or open an adress.

example:
getURL(" "_blank");

Yep I know about the font tag :) But I was beeing lazy and also its simple and works on all browsers.

However my problem remains. Since I've tried adding flash both with SWFobject and the (standard) object tag. I'm starting to think that adding flash content via document.write(....."myflash.swf"....) breaks in all cases under IE6.

One thing I haven't tried is using externalInterface (flash) this basically calls JS functions directly from the page that holds the main flash.

Flash calls JS via ExternalInterface >>> JS function writes a new window and adds the new flash object to it with object tag or swfobject.

But I still doubt it will work tho since I think document.write() is what is causing this.

Is there any other way to write content to a document except document.write() is JS ?

Thanks
L. Ivanov.
 
Found the simplest of solutions for me.

So:
Flash calls JS
but instead of using document.write()
I call a PHP file (while parsing to it the video URL)
and create the JS/HTML for the swfobject

presto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top