I want to close the current tab using javascript. But i did not got any solutions. I searched the whole internet for this and some of the post suggest below solution.
$("#click").click("click", function(element) {
window.top.close();
});
But after clicking the button getting Scripts may close only the windows that were opened by it. as a warning in the console. Is there any possible way to close the current tab which are not opened by any script?
window.close()will work. However, as the error states, you cannot close another tab which was not opened through code.$(selector).on('click', function(e))rather than$("#click").click("click", function(e)