Search results
4 lis 2013 · The solution I chose is to issue the window.close, followed by a window.setTimeout that redirects to a different page. That way, if window.close succeeds, execution on that page stops, but if it fails, in a second, it will redirect to a different page. window.close(); window.setTimeout(function(){location.href = '/some-page.php';},1000);
Use open () to open a window and close () to close the window: let myWindow; function openWin () {. myWindow = window.open("", "myWindow", "width=200, height=100"); } function closeWin () {. myWindow.close(); }
28 paź 2024 · The Window.close() method closes the current window, or the window on which it was called. This method can only be called on windows that were opened by a script using the Window.open() method, or on top-level windows that have a single history entry.
19 mar 2022 · window.open ('your current page URL', '_self', ''); window.close (); edge browser not close. I did some testing on this issue, and with reference to the relevant documentation, I think this result is reasonable. Just refer to this doc: the latest working spec for window close (). As metioned in this doc:
23 wrz 2019 · First: Opening and Closing Windows. Windows are opened with. window.open (); — full syntax here. Windows are closed with. *window.close (); — full syntax here (but not always!)*. This is where the MDN statement comes into play. A simple example should clear this up.
26 lip 2024 · close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. Note: There is also a way to stop the worker from the main thread: the Worker.terminate method.
a.html에서 self.opener = self; 혹은 self.opener = null; 을 설정한 후 오픈된 b.html에서 opener.close()를 호출하면 된다. 사실 좀 복잡할지 모르지만 한두번 해보면 금방익숙해 진다.