deanagit / swfobject

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

ExternalInterface SWF in IE embedded host does not load #443

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use IE embedded host (eg: IETester
http://www.my-debugbar.com/wiki/IETester/HomePage)
2. Embed a flash file that uses ExternalInterface using SWFObject dynamic
publishing
3. Refresh page, or browse away and back to the page

What is the expected output? What do you see instead?
Flash loads and displays.
Flash is not loaded, and no functions exist (LoadMovie, StopPlay, Play,
ExternalInterface exported functions, etc).

What version of the product are you using? On what operating system?
Flash Player 10, XP, IE 6/7/8

Please provide any additional information below.
The fix is to include the "data" attribute.  For some reason the flash
plugin chokes for SWFs that use ExternalInterface unless they have a "data"
attribute when using IE as an embedded host (mshtml).

Original issue reported on code.google.com by jhiswin on 1 Mar 2010 at 5:11

GoogleCodeExporter commented 9 years ago
With the data property, are you talking about the data property on the top 
level 
<object> tag ? The only time the data property is normally used is for non IE 
browsers to set the location of the swf. If running under IE, the location is 
always 
specified through the nested movie param.

This seems like something which should be reported to the My Debugbar team and 
added 
to their FAQ, rather than reporting a "bug" for SWFObject. It is not usual to 
set the 
data property on an IE <object>, and we would not look to make this change.

Original comment by aran.rhee@gmail.com on 1 Mar 2010 at 11:12

GoogleCodeExporter commented 9 years ago
It doesn't just happen with IETester.
Any MSHTML hosted control behaves like this, I only used IETester as an example.
I'll attach an example binary and example page to show what I'm talking about.

The gist of it is, even though IE doesn't actually use the top-level data 
attribute,
it refuses to load an SWF with ExternalInterface in a MSHTML hosted control if 
there
is no data attribute present if you insert it dynamically.

Original comment by jhiswin on 2 Mar 2010 at 12:24

GoogleCodeExporter commented 9 years ago
Okay, I attached a quick page that shows the problem.
I use persist.swf from http://github.com/lloyd/persist-js
(But any swf that implements ExternalInterface would do)

This will happen in any MSHTML host, including applications like Pyjamas 
Desktop,
Maxthon, GreenBrowser, IETester, etc.

To see the problem:
Open up any application that uses MSHTML.
Click the link to see that it is accessible.
Refresh the page, or browser away and back to it.
Click the link to see that it is not accessible.

Original comment by jhiswin on 2 Mar 2010 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago
Alternatively, could you make it possible to add the "data" attribute?
Right now it gets filtered out and automatically assigned to the movie 
parameter.

Original comment by jhiswin on 2 Mar 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Thanks for the detailed follow up. I understand what you are seeing.

At this stage I am unsure if adding the data tag will adversely affect 
anything, so 
thorough testing would be required.

I would just say that this is a great use case for patching SWFObject for your 
own 
specific needs except that Maxthon was (is?) quite a popular browser for people 
using 
<= IE7 (I used to use it myself). 

I will mark this as accepted, and it will be discussed with the team members. I 
will 
add another comment once it has been discussed.

Original comment by aran.rhee@gmail.com on 2 Mar 2010 at 5:51

GoogleCodeExporter commented 9 years ago
Adding a note here about ExternalInterface and MSHTML.
In general it seems that dynamically inserted ExternalInterface SWF just 
doesn't play
well with MSHTML hosts, so it may not be worth patching.
The data attribute allows it to work on refresh, but browsing back and forth 
still
has issues.

Original comment by jhiswin on 15 Mar 2010 at 11:08

GoogleCodeExporter commented 9 years ago
I am having a similar issue and none of the external interface functions show 
up in
the DOM (verifying using Firebug Lite).

When the flash player is loaded up first time, everything loads up fine. But 
when it
loads up from the cache, it doesn't have any of the ExternalInterface callbacks.
Disabling cache is a workaround but that increase the load time. 

I was testing with the embedded browser object in SWT.

Original comment by siva.ki...@gmail.com on 21 Apr 2010 at 6:33

GoogleCodeExporter commented 9 years ago
Is there any known work around to make this work without disabling the cache ?

Original comment by siva.ki...@gmail.com on 21 Apr 2010 at 6:33

GoogleCodeExporter commented 9 years ago
Just want to update on the situation.  It's been a while now, but it should 
still be somewhat useful.  The below is what I have been doing.  If you have a 
better solution, please do tell.

FYI, disabling cache does not guarantee it will behave right.  If you do more 
testing you will find that it still misbehaves.  MSHTML+ExternalInterface just 
doesn't play nice.  If you look at the DOM tree, seems ExternalInterface flash 
isn't in the DOM tree.

It seems that the only way to deal with this problem is:
Use document.write or static publishing
Use above to insert dummy ExternalInterface flash, and use LoadMovie
Use Webkit/Gecko instead (tongue in cheek)

Original comment by jhiswin on 20 Jan 2011 at 6:36

GoogleCodeExporter commented 9 years ago
And another way I dealt with it was to use pure DOM methods to build and insert 
the object.
A caveat is that LoadMovie of ExternalInterface will not work.

Original comment by jhiswin on 20 Jan 2011 at 9:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is not a SWFObject defect by any means, and as an enhancement request, it 
is in very low standing -- the behavior expected by the IE embedded host 
platform is unusual, dare I say an 'edge case'.

I recommend using jhiswin's suggestion(s) as a workaround. 

Another avenue would be to use swfobject.embedSWF's callback function to add 
the data attribute to your <object>. The callback function is covered here:
http://learnswfobject.com/advanced-topics/the-callback-function/

A basic example would be:

   var callback = function (e){ 
      if(!e.ref.getAttribute("data")){
         e.ref.setAttribute("data", "test.swf");
      }                 
   };

   swfobject.embedSWF("test.swf", "myContent", "300", "120", "8.0.0", "expressInstall.swf", false, false, false, callback);

This example successfully inserts the data attribute in my tests (IE7, WinXP) 
and might fix the ExternalInterface issues stated above.

Original comment by platelu...@gmail.com on 23 May 2011 at 4:56