nageeb2016 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

getObjectById return different values on IE9 and FF8 when flash isn't installed #599

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
0. (Make sure to run the test with a browser with flash not installed)
1. Include a SWF file with the static method
2. Call swfobject.registerObject and define a callback
3. In the callback, try to log swfobject.getObjectById()

What is the expected output? What do you see instead?
I've only made tests on IE9 and FF8.
IE9 : The return value of getObjectById is null
FF : The return value of getObjectById is the inner <object> tag

I think getObjectById should return the DOM element of the Flash movie in both 
cases, no matter if Flash is installed or not.
One can already use getFlashPlayerVersion to check if Flash is installed or not 
(it correctly returns 0.0.0 on both platforms)

What version of the product are you using? On what operating system?
SWFObject 2.2, hosted on google CDN.
Tests done on IE9/Windows Seven and FF8/Windows 7

Please provide any additional information below.

Original issue reported on code.google.com by timcc.pe...@gmail.com on 28 Oct 2011 at 9:07

GoogleCodeExporter commented 9 years ago
swfobject.getObjectById should return null in both cases. If using 
swfobject.registerObject and Flash is either not found or the minimum version 
is not met, SWFObject should remove the <object> nodes, leaving the alternate 
content in their place. swfobject.getObjectById should therefore fail because 
the <object> will no longer exist.

Some of the inner workings of both swfobject.getObjectById and 
swfobject.registerObject have been updated for the beta of SWFObject 2.3, and 
should fix this issue.  Please give it a try and see if it helps:

https://github.com/swfobject/swfobject/blob/master/swfobject/src/swfobject.js

Original comment by platelu...@gmail.com on 28 Oct 2011 at 6:57

GoogleCodeExporter commented 9 years ago
I've tested with the link you provided and there is some improvement, but not 
what you suggested :

On both IE9 and FF6, I'm calling getFlashPlayerVersion in registerObject 
callback, and I got 0.0.0. So, Flash is definitely not installed/loaded.

Then, I'm trying getObjectById and I got a DOM element returned in both 
browsers (with the 2.2, I got null in IE9 here).

But, when inspecting the html through the IE9 dev tools or through Firebug, I 
can see that the whole <object> node is still here, and has not be replaced 
with the alternate content.

FWIW, I'm loading SWFObject in the head, insert the SWF in the middle of the 
page using static publishing, then run swfobject.registerObject in my main js 
file loaded at the bottom of the page (but not in the onload event)

Original comment by timcc.pe...@gmail.com on 31 Oct 2011 at 9:52

GoogleCodeExporter commented 9 years ago
thank you for the information, i will look into it.

Original comment by platelu...@gmail.com on 31 Oct 2011 at 5:18