窗口在FireFox问题中关闭 [英] window Close in FireFox Issue

查看:90
本文介绍了窗口在FireFox问题中关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有两页
1. default.html
2. login.html

在应用程序启动页面中为default.html.运行此页面时,将使用单独的窗口打开login.html(在我的情况下,将以全视图打开应用程序).同时default.html将再次重新打开并立即关闭.

以下来源在chrome,safari中正常工作.但是,它不仅在Firefox中起作用.

default.html

Hi All,

I have two pages
1. default.html
2. login.html

In application startup page is default.html. When run this page will open login.html with separate window(in my case will open the application in full view). At the same time default.html will reopen again and close immediately.

The following source is working fine in ie,chrome, safari. But It is not working in Firefox only.

default.html

<pre lang="xml"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript">
        function openWin() {
            var qry = window.document.location.href;
            var val = qry.indexOf("flag");
            if (val == -1) {
                window.open("login.html", "Login");
                var selfwin = window.open("default.html?flag=open", "_self");
                selfwin.close();
            }
        }
    </script>
</head>
<body onload="openWin();">
</body>
</html>
</pre>




login.html




login.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <form id="frmlogin">
    <h4>
        Login Page</h4>
    </form>
</body>
</html>

推荐答案

您写道:
var qry = window.document.location.href;


W3schools说


W3schools says

The location object is part of the window object and is accessed through the window.location property.

Note: There is no public standard that applies to the location object, but all major browsers support it.


看到他们的第一句话.您应该尝试


See their first sentence. You should try

var qry = window.location.href;



干杯,
彼得



Cheers,
Peter


这篇关于窗口在FireFox问题中关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆