窗口开瓶器关闭问题的JavaScript [英] window opener close issue for javascript

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

问题描述

浏览器使用javascript处理窗口管理有问题。
我在概念证明应用程序中有两页。第一页包含登录信息(用户名,密码,登录按钮等),第二页是管理屏幕。我需要当用户按下登录屏幕上的登录按钮时,它打开主屏幕和主屏幕,必须打开新的窗口,而不是全屏。我的意思是关闭,最小化,最大化按钮和Windows操作系统的底部栏必须留在屏幕上。

在登录屏幕上打开新窗口时,它必须自动关闭。我发现了很多示例脚本,但每个脚本都给了我相同的结果。



例如,下面的脚本解决了我的问题,但同样的问题继续给我,


firefox does not关闭opener窗口它自己,
ie 6.0关闭开启窗口 - 它的工作
即7.0 - 8.0之前关闭自我它问你正在查看的网页正试图关闭窗口。




  window.open(Content / StartPage.aspx,windowName,menubar = 0 ,location = 0,resizable = 1,status = 1,width =+ screen.width +,height =+ screen.height); 
if(window.name!= windowName){
var me = window.self;
me.opener = window.self;
me.close();
}

如何在不询问浏览器的情况下打开新窗口并关闭开启符题 ?



谢谢。

解决方案

浏览器的保证,有一些行动,不允许通过JavaScript直接管理,没有用户干预。

I have a problem with browsers window managament with javascript. I have two page in my proof of concept application. First page contains login information (username, password, login button etc.) and second page is a managament screen. I need that when the user pressed to the login button on the login screen it open to main screen and main screen must be open new window without full screen. I mean close, minimize, maximize buttons and bottom bar of the windows os must be stayed on the screen.

During opening the new window on the login screen, it must be close itself automatically. I have found many example script but every script giving same results to me.

For example; following script solving my problem but same problems continue for me,

firefox does't close opener window it self, ie 6.0 closing opener window - it's working ie 7.0 - 8.0 before the close it self it asking "The webpage you are viewing is trying to close the window".

          window.open("Content/StartPage.aspx", windowName, "menubar=0, location=0, resizable=1, status=1, width=" + screen.width + ",height=" + screen.height);
        if (window.name != windowName) {
            var me = window.self;
            me.opener = window.self;
            me.close();
        }

How can i open new window and close the opener with above requirements without ask browsers question ?

Thank you.

解决方案

You cannot do it according the security assurance of browser, there are some action which doesn't allow to be managed directly via javascript without user interference.

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

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