Flex open IE window and call the javascript

sponsored links
package util
(
import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.net.navigateToURL;

public class OpenWindow
(
public function OpenWindow (url: String, window: String = "_blank", features: String =""){

var WINDOW_OPEN_FUNCTION: String = "window.open";
var myURL: URLRequest = new URLRequest (url);
var browserName: String = getBrowserName ();

if (getBrowserName () == "Firefox") (
ExternalInterface.call (WINDOW_OPEN_FUNCTION, url, window, features);
)
/ / If IE,
else if (browserName == "IE") (
ExternalInterface.call (WINDOW_OPEN_FUNCTION, url, window, features);
/ / ExternalInterface.call ( "function setWMWindow () (window.open ( '" + url + "');}");
)
/ / If Safari
else if (browserName == "Safari") (
navigateToURL (myURL, window);
)
/ / If Opera
else if (browserName == "Opera") (
navigateToURL (myURL, window);
) Else (
navigateToURL (myURL, window);
)

/ * Alternate methodology ...
var popSuccess: Boolean = ExternalInterface.call (WINDOW_OPEN_FUNCTION, url, window, features);
if (popSuccess == false) (
navigateToURL (myURL, window);
) * /

)

/ * Get the name of the browser * /
private function getBrowserName (): String (
var browser: String;

/ / Uses external interface to reach out to browser and grab browser useragent info.
var browserAgent: String = ExternalInterface.call ( "function getBrowser () (return navigator.userAgent ;}");

/ / Debug.text + = "Browser Info: [" + browserAgent + "]";

/ / Determines brand of browser using a find index. If not found indexOf returns (-1).
if (browserAgent! = null & & browserAgent.indexOf ( "Firefox")> = 0) (
browser = "Firefox";
)
else if (browserAgent! = null & & browserAgent.indexOf ( "Safari")> = 0) (
browser = "Safari";
)
else if (browserAgent! = null & & browserAgent.indexOf ( "MSIE")> = 0) (
browser = "IE";
)
else if (browserAgent! = null & & browserAgent.indexOf ( "Opera")> = 0) (
browser = "Opera";
)
else (
browser = "Undefined";
)
return browser;
)

/ * Call external js function * /
public static function callOuterJsFunction (functionName: String, ... parameters): void
(
ExternalInterface.call (functionName, parameters);
)

)
)
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Flex open IE window and call the javascript

  • js examples of common events

    <html> <head> <script type="text/javascript"> / / Which mouse button is clicked function whichButton1 (event) ( if (event.button == 2) ( alert ( "You clicked the right mouse button!") ) else ( alert ( "You c ...

  • extjs development environment set up and practice

    1, download and extract the extjs 2, download eclipse and Eclipse AJAX Toolkit Framework (ATF) I have been accustomed to using eclipse as a development environment, a variety of open-source plugin so that eclipse has all-around performance, operating effi

  • flash chart summary

    pen Flash Chart is an open source Flash chart drawing tool, offers a variety of programming interfaces, including PHP, Ruby, Perl, Python, Java,. Net, AS, JS, etc. to generate a variety of data interfaces, and then Flash to display the function is to ...

  • IBM Ajax Tutorial Series

    Links: http://ibm.csdn.net/ISN_J.aspx?action=JMP&pointid=1550 Part 10: Using JSON for data transmission In the asynchronous application to send and receive information, you can choose to plain text and XML as data format. Ajax grasp of this issue ...

  • jquery ajax example

    1. Check js file $. ajax (( type: "GET", url: "test.js", dataType: "script" )) 2.post data $. ajax (( type: "POST", url: "xxxx", data: "name = zhaoaiqing & age = 25", success: function ( ...

  • Strength of live practice teaching materials, suitable for each person team look - UFIDA Hua Table CTO talk about "out of the software factory"

    A few months ago, on reading "Going the software factory," one book, not yet published at that time, it can be considered the reference of the watch. Although the language rather uneventful, but the contents of people really can not but carry on

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • Software development sunflower Baodian [reprint]

    Master the ability to reuse code very familiar with the new API's fast. This is because, he once used a lot of the API, have a lot of reusable code. He knows what is available and what is deficient. He has been using Qt, also used by gtk +, also used

  • can not be represented as java.sql.Timestamp

    Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries