Is there a way to just close my browser window, guaranteed? Last time, when I heard, the call window.close()or self.close()only works when starting the current window from another window. Is there a way to force most browsers to close the current window if this is not the case?
window.close()
self.close()
It is not possible to close the parent window using a script without a request in any major browser.
So no, no guarantees. In the child window window.closeand self.closework fine.
window.close
self.close
firefox , , , firefox, : http://support.mozilla.com/en-US/questions/749393
, IE
,
Try this (working in Chrome and IE) -
function closeWindow() { window.open('', '_self', ''); window.close(); }
Source: https://habr.com/ru/post/1791107/More articles:Create a two-step Django admin form to add an object? - djangoJava AWT drawImage condition - how to use synchronized to avoid it - javaDjango admin site: how does the "Add User" page work (more fields when editing)? - djangoHow to create a fully customizable / shared LINQ to SQL database connection? - visual-studio-2010Why is UIDeviceOrientationDidChangeNotification not always registered? - cocoa-touchCocoa - Custom NSStatusItem appearance in the menu bar - cocoaJMS alternative - javaHTML canvas displays text slightly different than browsers - javascriptjQuery div position in the middle of the page - jquery.NET Framework and Version Compatibility - .netAll Articles