javascript - window.close() not working when button is pressed but works when added to console(developer tools) -


i have simple script activated when button on window opened script clicked (meaning, page in current code exists opened window.open in page):

var botoncerrar = document.getelementbyid('cerrar');         botoncerrar.addeventlistener('click', function(){             open(location, '_self').close();         }, false); 

the thing is, not work, "refreshes" window.

but when add command in console inside developer tools:

        open(location, '_self').close(); 

it works. idea why?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -