Flex open IE window and call the javascript

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);
)

)
)

分类:Web 时间:2010-04-17 人气:368
分享到:
blog comments powered by Disqus

相关文章

  • ie, chrome, firefox, safari, opera html5 2008-07-31

    When the Ming among mainstream browsers chrome, firefox, safari, opera have been supported or are prepared to support HTML5, only ie does not support, for good or MS disappointed! html5 Usage: http://kb.operachina.com/node/190 html5: Effect Demo: htt

  • 在IE,Firefox,Safari,Chrome,Opera浏览器上调试javascript 2014-03-14

    前支持javascript调试功能的工具越来越多,主要分为ie和firefox两大阵营.其他浏览器上很难调试javascript.而Javascript Debug Toolkit解决了这个问题,可能在所有支持ajax请求的浏览器上调试javascript. Javascript Debug Toolkit 是一个开源免费的eclipse插件,官方主页:http://code.google.com/p/jsdt 下图给出一个调试工具支持的浏览器对照表 工具\浏览器 Ie Firefox Safa

  • 无间断滚动的新闻文章列表,兼容IE.Firefox和Opera,符合W3C标准.可作Marquee 2014-04-23

    <!--Quirks Mode--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv=&

  • Address in Firefox, div layer always flash layer covering the issues and full-screen problems (Flash content always floating on top of the page issue) 2010-05-27

    Original link: Flash content always float to resolve the top issues on the page I have two friends to the reaction of the Flash MP3 Player can not and lightbox problems like plug-compatible, their symptoms, when open the lightbox effect of the pictur

  • The CSS is compatible with the Firefox.Safari IE6.IE7 Summary 2010-07-12

    1. Padding & margin padding time, IE & Firefox, like, div's size will increase, div padding the corresponding position to increase the value of the corresponding position. Margin time, IE6, IE7 div's parent container to benchmark the margin of, Fi

  • safari,opera嵌入iframe页面cookie读取问题解决方法 2014-04-14

    最近做的合作网站嵌入到对方的iframe中去,在safari,opera和有些版本的搜狗浏览器(内核版本原因)中不能读到cookie. 查到原因是因为在这些浏览器中对第三方的cookie安全验证比较严格,需要确认是用户主动到第三方网站的,才能读到cookie,于是加个引导页面要用户点击下才能进入我们的组件. 1,首页 判断是否是这些浏览器,若是则去引导页面,其中reflag是判断是否已经去过引导页面.若已经引导过就不去引导页面了. function safarireload() { var re

  • Five judgments IE.Firefox.Safari.Chrome.Opera browser js 2011-01-05

    IE Only IE support and the creation of ActiveX controls, so all other browsers do not have something, as long as the window object to determine whether there ActiveXObject function, you can clearly determine the current browser is IE. UserAgent vario

  • Chrome,Firefox,IE,Opera,Safari五款浏览器13个版本速度比拼 2014-06-24

    Chrome 1.0/2.0/3.0.Firefox 2.0/3.0.11/3.5b99.Internet Explorer 6/7/8.Oprea 9.6/10.Safari 3.1.1/4.0--如此多的浏览器,如此多的版本,且不说功能和安全,单就速度来说哪个更快?谁能更好地适应当今越来越复杂的互联网环境? 今天我们就用Sunspider和Futuremark Peacekeeper对它们进行一次全方位的考察.两个项目都以衡量浏览器的JavaScript性能为主,这也直接决定了浏览器的实际速

  • javascript image pre-load compliant Firefox: Chrome: Opera: Safari: 2010-07-02

    After some analysis, and finally found one for each browser compatible Image of the property - complete. Therefore, the onload event in the picture before clicking on the value judgments can be made. Finally, the code becomes like the following: func

  • jQuery一步一步实现跨浏览器的可编辑表格,支持IE.Firefox.Safari.Chrome.Opera 2015-02-10

    在修改数据时,有时候为了方便,我们希望能够直接在表格里面对数据进行直接修改. 要实现可编辑的表格功能,我们要解决以下问题: 1.明确要修改的数据在表格中是哪些列(如何找到这些单元格); 2.如何让单元格变成可以编辑的; 3.如何处理单元格的一些按键事件; 4.解决跨浏览器问题. 我们通过jQuery可以一步一步解决上述问题. 一. 绘制表格 首先我们先画好一个表格. Code1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transition

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.132 (s). 12 q(s)