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

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -