最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Why does my call from flash to Javascript fail in IE9? - Stack Overflow

programmeradmin3浏览0评论

I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this:

ExternalInterface.call(
        "myLovelyFunction",
        string1, string2);

and the code in the JS looks like this:

function myLovelyFunction(string1, string2) {
    window.open('.mysite%2Fapage.php&via=atwitteraccount&text=Some%20text%22&related=atwitteraccount',
    'windowname',
    'height=290,width=510');
}

In IE9, the function does absolutely nothing, but the console plains with:

SCRIPT438: Object doesn't support property or method 'SetReturnValue' 
index.php, line 1 character 1

line 1, character 1 is obviously pointing at nothing in particular.

I can make it work fine by switching on patability view, although the console error doesn't go away.

Is there anything about IE9 that causes this, and more importantly, how do I fix this?

I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this:

ExternalInterface.call(
        "myLovelyFunction",
        string1, string2);

and the code in the JS looks like this:

function myLovelyFunction(string1, string2) {
    window.open('https://twitter./share?url=http%3A%2F%2Fwww.mysite.%2Fapage.php&via=atwitteraccount&text=Some%20text%22&related=atwitteraccount',
    'windowname',
    'height=290,width=510');
}

In IE9, the function does absolutely nothing, but the console plains with:

SCRIPT438: Object doesn't support property or method 'SetReturnValue' 
index.php, line 1 character 1

line 1, character 1 is obviously pointing at nothing in particular.

I can make it work fine by switching on patability view, although the console error doesn't go away.

Is there anything about IE9 that causes this, and more importantly, how do I fix this?

Share Improve this question edited Nov 19, 2011 at 0:14 izb asked Nov 18, 2011 at 23:58 izbizb 51.9k39 gold badges118 silver badges172 bronze badges 5
  • 2 seeing your actual code instead of "something like this" would be very helpful. Maybe even a link to a test site? – Kevin Anthony Oppegaard Rose Commented Nov 19, 2011 at 0:05
  • added the plete body of the js function, although the body of the function seems not to matter at all. – izb Commented Nov 19, 2011 at 0:14
  • Do you happen to have something like this Foobar.SetReturnValue() and an HTML element with an ID of Foobar in your page ? – HoLyVieR Commented Nov 19, 2011 at 4:29
  • No, but if references jQuery 1.6.2 from google's CDN, if that's a clue. – izb Commented Nov 19, 2011 at 9:18
  • If you have myLovelyFunction take no parameters at all does it run? – felipemaia Commented Nov 20, 2011 at 16:21
Add a ment  | 

2 Answers 2

Reset to default 6

I had this very same issue as well. I was using the following code:

    <object type="application/x-shockwave-flash" data="/files/banners/64/64_300x250.swf" width="300" height="250">
      <param name="movie" value="/files/banners/64/64_300x250.swf"/>
      <param name="wmode" value="transparent"/>
    </object>

I'm just embedding the flash with a regular object tag (no SWFObject and no embed fallback). My flash file calls the JS function window.open via ExternalInterface like this:

ExternalInterface.call("window.open", url, target, features);

What didn't work: The link above suggests changing it to "document.open", which did not work. Also attempting to force the page to render in IE-8 mode did not work. For example:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

What did work: Simply adding a "name" and "id" to the object tag solved the issue. For example:

<object type="application/x-shockwave-flash" data="/files/banners/64/64_300x250.swf" width="300" height="250" name="flash_object" id="flash_object">

Had absolutely the same issue, link below helped to solve it.

http://msdn.microsoft./en-us/library/gg622942%28v=VS.85%29.aspx

发布评论

评论列表(0)

  1. 暂无评论