Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

html - window opener close issue for 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...