Destroy SWF DOM in swfupload - javascript

I am using swfupload for uploading files and I have this problem:
In Internet Explorer, I have to use destroy(). Otherwise it crashes
http://demo.swfupload.org/Documentation/#destroy
In Firefox, if I use destroy(), it crashes.
So the solution is to detect browser type and only destroy in Internet Explorer. Is it how it works? Or did I do something wrong? I mean is the destroy() function only for IE??

I know this is late but try wrapping the SWF in another element and destroy that element.

Related

JavaScript detect iOS Firefox

This is a follow up from Append within Append, Iframe within Append in Jquery
I realize the code works against most browsers but doesn't work in Firefox mobile iOS. Can anyone enlighten me how I can detect iOS Firefox so that I can display a error to user?
I read about modernizr about feature detect but it doesn't seems to detect about Firefox not writing to iframe if refreshed. So I wish to just display an error for now.
To detect Firefox in iOS, i only complished that after seeing user agent of Chrome, Safari and Firefox. We can see 'FxiOS' is the only difference between them, Firefox user agent string reference
. All CSS hacks dont't for iOS.
My solution:
function isFirefox() {
return navigator.userAgent.match("FxiOS");
}
You can read the user-agent with JS by using the window.navigator.userAgent property.
See: https://developer.mozilla.org/nl/docs/Web/API/NavigatorID.userAgent
For the Firefox specific values see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference)
It would still be recommended to do feature-checking instead of checking the user-agent string, since there might be another browser out there in which it doesn't work.
If you cannot figure out which specific feature to check for to distinguish your case, you could always check for success after trying to write to the iFrame. So simple write some random data to the iFrame, try to read it back, and if you cannot read it back you display your error message. This should work for browsers you might have never even heard of.

Site makes web browser suddenly stop and turn off in some IE browsers

the site link is http://www.kosfan.com (korean site)
in some web browser (IE 7 and 8), the site suddenly stop and turn off in not only main pages but also other pages.
i have tried to find the reason why it happens, but i cannot.
i thought that possible reasons are javascript error, onload(ready) function and ajax-load something like that.
is there any one who can solve this problem? help me!
thanks :)
I've had similar issues with IE and JQuery - it is definitely bug of the IE browser. You need to go debug the code and find where the crash happens. In my case it was a problem of accessing an element by id in JQuery way. When I replaced $("#id") for document.getElementById it stopped crashing :-)

Trying to access Flash movie from JS works in FF, but not in IE

I am setting up a Flash based MP3 player control (The standalone version of WordPress Standalone Player). I have a situation of multiple windows with players open. One window opens the other, so I have the window.opener property available.
When the child window is opened, I want to programmatically mute the audio player in the parent window.
This works in Firefox, but not in IE 7 and 8. I know little about Flash/Javascript interaction and I'm stuck. I am not getting any error messages.
To do this, the player SWF object has a setVolume() and close() function. These functions are not defined anywhere in Javascript so I guess that those are provided by the Flash object. This is supported by the following lines I found in the Flash source code of the player:
if (ExternalInterface.available) {
ExternalInterface.addCallback("load", Application, Application.ei_loadFile);
ExternalInterface.addCallback("close", Application, Application.ei_closePlayer);
ExternalInterface.addCallback("open", Application, Application.ei_openPlayer);
ExternalInterface.addCallback("setVolume", Application, Application.ei_setVolume);
In Firefox, this works:
if (typeof(AudioPlayer) != "undefined")
var player = AudioPlayer.getPlayer("audioplayer_1"); // This shows up as
// the player SWF object
// in Firebug
if (player)
if (typeof(player.setVolume) == "function")
player.close(); // This works in FF but not in IE
but in IE, it doesn't. Is this because the callback is not available in IE? Or is there anything I need to do in addition?
If it works in FF but not IE, then the issue is likely in the JavaScript code. ExternalInterface is pretty reliable (99% of the failures I encounter are a result of JavaScript issues, not ActionScript issues). Is window.opener supported in IE? Have you tested your JavaScript in a page without the Flash stuff to make sure the code works?
edit: how do I post this as a comment and not an answer??
edit edit: nvm, I am not cool enough yet to comment.

flash activate internet explorer

as you all know that if we use flash object in web page in internet explorer
Internet Explorer displays a box around Flash content and show a tooltip telling the user to click to activate the content.
i am using fixit it work fine but problem is once page loaded completely.
this object load it again.
any other solution...?
Thanks
did u try
http://code.google.com/p/swfobject/
use it.
http://code.google.com/p/swfobject/
You need to embed the Flash movie using SWFobject or any other javascript method out there.

Object Focus problem with Safari and Chrome browsers

I have the following javascript being called to request a focus when page is loaded.
This code works 100% OK with Firefox and IE7, but Chrome and Safari do not seem to move the focus at all. How to make it work with all browsers?
document.getElementById("MyFlashFile").focus();
It took me hours searching the Internet, but finally I found a solution that works on the lastest versions of IE, Firefox, Chrome and Safari.
The following code solves the problem for good:
<head>
<script type="text/javascript" src="swfobject.js"></script>
<script>
function setFocusOnFlash() {
var f=swfobject.getObjectById('myFlashObjectId');
if (f) { f.tabIndex = 0; f.focus(); }
}
</script>
</head>
<body onload="setFocusOnFlash()">
This example assumes the flash is embedded using the SWFObject library. If not, you should set the f variable to the Object or Embed tag which holds the flash movie.
Edited on 5 May 2012: Well, unfortunately it seems that the tabIndex workaround no longer works for all combinations of browser (Chrome/Safari) and operating system.
For instance, currently Chrome 18 on Windows fails.
See the link below, provided by Christian Junk, to get the status of the problem's resolution.
Unfortunately there is no way to ensure that you can set focus to a flash file that works in all browsers. IE and Firefox have solved this problem (for the most part), but Chrome and Safari are both based off of Webkit which does not have a solution.
If you ever notice on YouTube or other video / flash site that the first thing you see is something to entice you to click on the player, that is due to this problem.
One developer came up with a clever workaround, but it does involve adding some ActionScript to your flash file, this can be a pain in the ass if you are building a generic player.
Gary Bishop: Fixing Firefox Flash Foolishness
Another sort of solution is to set your wmode to opaque. I've heard this works in some situations, but will screw up cursors in text areas. I haven't had much luck with this either, but you can give it a shot.
You can find more information about the no focus bug on bugzilla.
It seems that there is a bug in Chrome:
"window.document.getElementById('swfID').focus() not working for flash objects"
http://code.google.com/p/chromium/issues/detail?id=27868
I've tried to find a workaround but I was not able to find one ;(
Regards,
Christian
In addition to Cláudio Silva answer , you need to set wmode="opaque"
Ensure this code is being called after the entire page has been rendered. It's probably being called above the HTML it refers to, so the element will not exist yet.
Various JavaScript frameworks have utilities to tell you when the DOM is ready.

Categories