![]() This seems to work OK, let me know if you think this is a viable solution. ![]() The Main page now has an Event listener to catch the hide and then close the window there. I have altered the sample so the Child page hides the window instead of closing it. The Main page then reloads to reflect changes made in the window. In the actual application the window is for data entry and the button click goes back to the server to do validation and save to database, then close the window and it's destroyed because each time it's opened it's completely different. JavaScript provides an in-built function named close() to close the browser window that is opened by using window.open() method. X.Js.AddScript("parentAutoLoadControl.close() ") Protected void btnClose_Click(object sender, DirectEventArgs e) Protected void btnOpen_Click(object sender, DirectEventArgs e)Ĭhild page loaded into Window, hit Close button Main Page to run, hit button to open window: See the Pen close a window in JavaScript by Omid Dehghan on CodePen. Window close() Method Return Value: There’s no return value from calling the method. Net 4.0, please let me know what you think. Window close() Method Syntax: window.close() Window close() Method Parameter: The method does not take an argument. Below is sample code, I'm using v2.5.1 in VS2010. This works because the window has now been opened by our script instead of the user. The window that was opened in the first step is closed by using this method. Close this open window using the close () method: The window.close () method closes the window on which it is called. I also found it works in Chrome v35 and FireFox v28. This is important as it makes the URL replace the current page. If I run IE10 in compatability mode it runs fine. I have a Main page that opens a Window, it has a Close button that calls a DirectEvent to go back to server to do 'stuff' then does the script include of parentAutoLoadControl.close() In IE10 I now get a javascript error "'Array' is undefined" on a fireEventArgs() call. ![]() My company is (finally) upgrading from IE8, and in testing with IE10 i've come across an error closing a window that works in IE8, and IE10 in compatability mode.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |