Modern browsers usually don’t allow this behavior and closing the current window or tab with jscript is doable only if you previously opened that window with jscript. However, searching for the solution about this topic I managed to make this work and here it is how.