fullcatrooms / swfobject

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

swfobject fails version detection in IE - effects millions of websites #298

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have discovered that there is a serious problem in swfobject.js and 
AC_RunActiveContent.js that fails to discover the flash version and hence 
all sites fail that depend on this. For more on this issue please refer to:

http://forums.adobe.com/thread/199162?tstart=0

Don Moir

donmoir@comcast.net

Original issue reported on code.google.com by donm...@comcast.net on 11 Apr 2009 at 2:54

GoogleCodeExporter commented 9 years ago
There are corrupt Flash Player installers in the open (a small percentage only) 
that
don't include the Player version, and therefore no script will be able to 
detect the
Player version. The problem is a corrupted plugin installation and not with the
detection scripts. 

> there is a serious problem in swfobject.js

No, there really isn't. The philosophy behind SWFObject is to only show Flash 
content
if we are sure the correct Player version is supported, in any other case 
alternative
content is shown.

Furthermore, uninstalling and reinstalling the Player like described in our FAQ 
does
solve the issue.

Original comment by bobbyvandersluis on 13 Apr 2009 at 8:05

GoogleCodeExporter commented 9 years ago
Certainly something unknown happens that removes the activex parameters from 
the 
registry. This can happen suddenly and without any user intervention. I had it 
happen to me after I had been using flash for a long time in IE. Since I am 
developer it was easy to determine that ShockwaveFlash.ShockwaveFlash.7 had 
been 
removed from the registy.... But ShockwaveFlash.ShockwaveFlash.10 was not. Now 
if 
ShockwaveFlash.ShockwaveFlash.7 is missing from the registry you cannot detect 
the 
flash version because it will throw an error in your current code. There are 
links 
if you want them where no amount of uninstall / reinstall will fix it... I am 
still 
trying to determine what causes the missing entries... Any of the players 
version 7 
thru 10 can be used to detect the version... You can of course choose to ignore 
it 
but I would hedge my bets if I were you and apply the very simple fix... It 
works... 
I have seen cases where all the entries were removed although....

Flash player works perfect as long as you not do version detection so it in 
itself 
is not corrupt... Its the registry entries that are removed suddenly.

Since many thousands of people do experience the problem... something should be 
done 
about it... Adobe, you, whoever... however... 

Original comment by donm...@comcast.net on 13 Apr 2009 at 8:40

GoogleCodeExporter commented 9 years ago
>>No, there really isn't. The philosophy behind SWFObject is to only show Flash 
content if we are sure the correct Player version is supported, in any other 
case 
alternative content is shown.<<

In my registry now I only have: HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash 
and 
HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash.10.. Normally there should be 1 
thru 
10....

Now you say "only if your sure" well your not so sure :) because your detection 
will 
fail on my machine... my detection will not...

Hopefully at least this will bring the issue to someone's attention that 
actually 
will stop passing the buck and fix it for sure...

It's clearly not your fault, but as I said you might want to hedge your bets...

Original comment by donm...@comcast.net on 13 Apr 2009 at 9:20

GoogleCodeExporter commented 9 years ago
SWFObject 2.1 instatiates the ActiveX Object for Flash, and uses the 
instantiated
Object to retrieve the active player's version number. Counting down numbers in 
not
necessary, and not forward compatible for the means that you describe yourself.

A snippet of the 2.1 code base:
if (typeof win.ActiveXObject != UNDEF) {
var a = null, fp6Crash = false;
try {
        a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
}
catch(e) {
        try { 
                a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
                playerVersion = [6,0,21];
                a.AllowScriptAccess = "always";  // Introduced in fp6.0.47
        }
        catch(e) {
                if (playerVersion[0] == 6) {
                        fp6Crash = true;
                }
        }
        if (!fp6Crash) {
                try {
                        a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
                }
                catch(e) {}
        }
}
if (!fp6Crash && a) { // a will return null when ActiveX is disabled
        try {
                d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
                if (d) {
                        d = d.split(" ")[1].split(",");
                        playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
                }
        }
        catch(e) {}
}

As you can see th v6/7 check is meant only in to avoid Flash Player crashes for 
very
old players (in the current 2.2 alphas these checks have been removed). So new
ActiveXObject(SHOCKWAVE_FLASH_AX) without a version number is what we would 
test for
in cases a 6 or 7 version isn't available.  

Original comment by bobbyvandersluis on 14 Apr 2009 at 11:23

GoogleCodeExporter commented 9 years ago
Yes indeed I see that the plain new ActiveXObject(SHOCKWAVE_FLASH_AX) does work 
for 
GetVariable("$version"). In the AC_RunActiveContent.js there is this as the 
final 
step:

try {
// version will be set for 2.X player
    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
    version = "WIN 2,0,0,11";
} catch (e) { version = -1; }

So you see no call to GetVariable("$version") here and of course now we have 
incorrect version detection as opposed to swfobject which does work in this 
case.

Ok so as I said my IE stopped working for Flash... I also went to other sites 
that 
use swfobject and they did not work either, so partially a made bad assumption 
about 
swfobject based on that. I did look thru the swfobject 2.0 code to verify and I 
missed the test for plain ShockwaveFlash.ShockwaveFlash, but regardless it 
still 
failed, so now I am wondering.

Your premise is:

>>Counting down numbers in not necessary, and not forward compatible for the 
means 
that you describe yourself.<<

I don't like this either but read on.

Phase 2: lol

Any or all of ShockwaveFlash.ShockwaveFlash entries can be removed (plain or 
numbered) from the registry. Why this happens is unknown. It just does.

In my case I only care about GetVariable("$version") so that means check for 10 
thru 
7 first. 99 out of a 100 this is going to trigger correctly right off. As far 
as 
this not be forward compatiable... It will be as long as registry is cool or 
one the 
of numbered items are there.

Now I have added plain ShockwaveFlash.ShockwaveFlash as you do. But this can be 
missing just as the numbered versions can. Just as a test remove all the 
ShockwaveFlash entries from the registry. You can uninstall / reinstall later 
haha.

So now I do this:

I do the normal version check using numbered and plain Shockwave flash. This 
will 
normally always catch it.

Then I go ahead and write the object regardless if the above version detection 
succeeded or not.

If the initial version detection does not succeed, then in onload I do another 
test 
on the swf object in question. In other words I do a 
movie.GetVariable("$version") 
after it has been written and test that for success or not. I am doing this in 
onload because it is just cross-browser friendly although we are just talking 
about 
IE. In IE the object is immediately available right after the document.write so 
you 
can take advantage of that. This always works if indeed Flash is installed and 
independent of the registry entries. You might ask why just not do this and 
forget 
about the initial version detection. Well I make it cleaner if I can detect it 
right 
off.

Now really I have better things to do as I am sure you do. I am tired of the 
Adobe 
no-help business. Happens a lot for many issues even if you file a formal 
complaint.

I appreciate your expertise and correspondence.

Please get back with your thoughts. I want to post whatever is the final word 
on 
this.

Thank you, Don

Original comment by donm...@comcast.net on 14 Apr 2009 at 4:16

GoogleCodeExporter commented 9 years ago
I think Don is right. I have IE 7.0.6001.1800 with flash 10.0.22.87. Using the
swfobject 2.1 and the code from the code generator, my page takes about 1-2 
minutes
to load, once its done loading, the alternate content is not displayed and it
displays the flash object, but its blank. When I right click on the flash 
object it
says "movie not loaded...". My test page is here: http://dev.aiso.net/test.htm 
I get
flash when i go here http://www.adobe.com/software/flash/about/

Can someone help me fix this, im getting users on our site using IE7 saying this
issue also occurs for them.

Original comment by stevencr...@gmail.com on 14 Apr 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Let me follow up with a couple things. All the ShockwaveFlash.ShockwaveFlash 
entries 
point to the same classid these days. So you can instantiate any one of them 
and 
call GetVariable("$version") on them. But it appears from the Adobe source 
code, and 
from some reading that it is only historically safe to call 
GetVariable("$version")  
on 7 and above. So that is how I arrived and 10 thru 7. Now there will only be 
one 
flash player so 7 thru 10 can be used to detect any version 7 or above. I am 
interested in 9 and above only but I can still use 
ShockwaveFlash.ShockwaveFlash.7 
or above to detect that. Now plain ShockwaveFlash.ShockwaveFlash was used in 
the 
past to detect the version 2 player. Bobby may have additional insight on this.

In reality though it appears that any of the ShockwaveFlash.ShockwaveFlash's 
can be 
used today to detect the player but not historically. Safest bet is still 
probably 7 
thru 10.

Don

Original comment by donm...@comcast.net on 15 Apr 2009 at 2:35

GoogleCodeExporter commented 9 years ago
Re comment 6: please use the discussion group for this:
http://groups.google.com/group/swfobject

Re: Any or all of ShockwaveFlash.ShockwaveFlash entries can be removed (plain 
or 
numbered) from the registry. Why this happens is unknown. It just does.

We love to hear about real live cases. Everything can be removed manually or be
manipulated, however how people get corrupt installments on their PCs is what 
we are
really interested in.

GetVariable("$version") also works correctly for FP6, if I'm correct it should 
work
from version 4 and up. In any case, nobody uses FP6 or lower anymore (we have 
hard
stats on that), so I wouldn't be too worried about low FP versions.

Original comment by bobbyvandersluis on 15 Apr 2009 at 9:30

GoogleCodeExporter commented 9 years ago
Yeah, how do the entries get removed for Flash ? Thats the million dollar 
question 
isn't it. Note that this happens without user intervention. It's not like any 
of my 
other entries are suddenly disappearing lol, just for Flash.

It's kind of a coinincidence that GetVariable("$version") will work for all the 
entries these days. plain and 1 thru 10. So it seems in the past that using 
plain 
ShockwaveFlash.ShockwaveFlash was used just to check the version 2 player. But 
as 
you can see it works for checking any player now as do 1 thru 10. This of 
course is 
because they all point to the same classid. But this is not historically true.

Original comment by donm...@comcast.net on 15 Apr 2009 at 12:40