user721588
user721588

Reputation:

Close window using JavaScript

I have a window(1) that has a button(1). If I click on the button, then another window(2) will appear. It also has a button(2). If I click on the button (2) then popup will appear. How can I close the window(2) if I press "OK" on the popup window? I am using javascript.

Upvotes: 0

Views: 554

Answers (2)

creativeby
creativeby

Reputation: 897

Read here about window management.

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.

Got this from here /stackoverflow/

Upvotes: 0

Elliot Bonneville
Elliot Bonneville

Reputation: 53291

// store reference to window
var window2 = window.open(...);

// close window via reference, put this in your OK button handler
window2.close();

Upvotes: 1

Related Questions