JavaScript event onClick close window not firing after clicking and viewing PrettyPhoto image.
HTML
<button type="button" onClick="closeWin()">Close Window</button>
JavaScript
function closeWin() {
window.close();
}
jQuery
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({
callback: function() {
closeWin();
}
});
});
You can close window by using
window.close();only by setting “off” security flagsIn firefox, you can do this by going into about:config, click “I’ll be careful, I promise” button and search for
You’ll see that it was set to false.
Make that true, you can close window by using window.close()
But this gives security issues.
There is another solution for closing the window, you can close the window which you opened.
Check that here: jsFiddle