Select to view content in your preferred language

ExternalInterface.call in windows 7

850
7
Jump to solution
06-13-2013 10:44 AM
RhettZufelt
MVP Notable Contributor
I know this is probably not the best place to ask, but hoping/wondering if someone has came across the same issue, and found a solution.

I am using ExternalInterface.call("window.open",#,#,#) to open a web page in a new browser window.

has been working just fine for some time now in windows XP (still is for the most part), however, we are now getting upgraded to windoze 7, and it is behaving differently.

Now, when I click on the feature that involks the ExternalInterface.call, I get three, new windows opening, all with the same URL.

anyone found a cause/fix for this yet?

Thanks for any help,

R_

PS, we are forced to use IE 8, so that is the browser being used.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Rhett,

  Hmm. I will have to see if I can find a Windows 7 PC that still has IE 8 (most are already IE 9 now). If you open a new window from JavaScript (which is what window.open is) then it is considered a PopUp Window. Have you put in a breakpoint or a trace statement to be sure you are not hitting the launch function more than once?

View solution in original post

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   I have not seen that issue and I have tested all major browsers on Windows 7. I am opening a popup window just fine in my new Google Street View Widget.

http://www.arcgis.com/home/item.html?id=b4259b1cf73e4fa3b04e7bdf75fee29b
0 Kudos
RhettZufelt
MVP Notable Contributor
Interesting, I will have to check it out.

When you say "popup window", is that a new browser window from externalinterface call as I get a message about blocked popup that I need to enable (that I don't get with my external call).  With my external interface call, it just opens a new browser window.  If clicked again (for a different site), it updates the same window with the new website.  On windoze 7, IE 8, each feature I click opens 3 new windows.  Click three of them, you get nine windows, etc.


This is my code (fired from the popuprendererskin)

private var feats:String = "scrollbars=1,width=450,height=400,resizable=Yes,location=Yes,toolbar=No";  // settings for the popup weather window

   private function launch(urlRequest:String):void 
   {
    ExternalInterface.call("window.open", urlRequest, "hms" , feats);
   }


Have narrowed it down to where it acts this way on windoze 7 32 and 64 bit with IE 8.  IE9 and it doesn't do it. 

Too bad our IT folks won't update to IE 9...



R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

  Hmm. I will have to see if I can find a Windows 7 PC that still has IE 8 (most are already IE 9 now). If you open a new window from JavaScript (which is what window.open is) then it is considered a PopUp Window. Have you put in a breakpoint or a trace statement to be sure you are not hitting the launch function more than once?
0 Kudos
RhettZufelt
MVP Notable Contributor
Ok, now I feel like an idiot.

Since it was working fine on XP machines, I didn't think to trace the launch function.  Now that I have, I see it is firing it three times.

Since I am window.opening a named window, it is supposed to open the new links in the same window each time.  On xp, I guess that is happening fast enough you only see the last "refresh/launch" in the single window.  not sure why on windoze 7 it opens in three, but once I figure out why it is firing my launch function multiple times, I can test that out.

Thanks again for pointing me in the right direction,

R_
0 Kudos
RhettZufelt
MVP Notable Contributor
Turns out there were a couple issues here.  First, my script was firing the launch function three times and is sending the URL with window.open to a named window.

Using a named window makes it either open a new window if it doesn't exist, or, if window with that name exists, open the new URL in that window.

So, on XP with IE8, all three were being sent to the named window, so the end result was just one window with my info.

However, it appears that IE8 on windoze 7 does not honor the named window, and opens a new one for each externalinterface call.   So, now I get a single window for each click.

Better than three I guess, but would be nice if I could figure out how to make it honor the named window (short of upgrading to IE9).

R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

  This is simple in JavaScript as you can keep a reference to opened window and you can just replace the content of the window using innerhtml. In my Street View Widget you will see that there is a utility class that allows you to have JavaScript code inside your MXML (util:JavaScript).
0 Kudos
RhettZufelt
MVP Notable Contributor
Thanks Robert, and sorry for the late response, been away, and now dragged in a different direction.

I'll look into the utility class and innerhtml, but really have not had the time I need to fully learn the in's and outs of the viewer itself in order to incorporate, but am getting by.  Now, or course, I've been dragged different direction, so time is even more limited. 

Not sure how to incorportate the java class to fire on/instead of a popup (on one layer only in my config), but is fairly easy in the popuprendererskin using externalinterface (Not the best results/format, but it works) (really like the FRinfowindow format, but don't like how the window content "moves" with the map and the window doesn't (or vice versa.))

At least I'm only calling it once now :rolleyes: so think I will have to live with it for now,  maybe get a chance to dive in/figure out the innerhtml stuff later.

Thanks again for your help,


R_
0 Kudos