Search code examples
javascriptwindow

window.close() generates an issue


this code generates problem [encountered problem of window] and close all the safari windows, but this code is working fine with Internet Explorer. What will I do ? have any alternative method for closing current opened window in every browser.

<input type='button' value='close' onclick='window.close()'>

Solution

  • Yeah that sounds pretty weird, this isn't documented behavior.

    Mozilla Gecko DOM reference: https://developer.mozilla.org/en/DOM/window.close

    MSDN Reference: http://msdn.microsoft.com/en-us/library/ms536367(VS.85).aspx

    Safari Reference documentation Domwindow.close() - you'll find, err, nothing.