Currently I have an application where a user hits a clicks on a URL and goes to my form. The user then enters his information into the form field, which is then sent through jquery ajax to a PHP script which enters it into the database. Upon success callback, it would alert the user that they had been registered and closes the current browser tab. (Let's just say I need the closing the browser tab behaviour to persist).
$.ajax({
type: "POST",
url: 'goToPHP',
data: data,
success: function(data){
alert('You Have Been Registered Successfully');
open(location, '_self').close();
},
error: function(data){
}
});
I understand that most modern browsers (Chrome included) are limiting the ability for javascript to only close tabs/windows it created for security reasons. Temporarily I had used open(location, '_self').close();
to get around the issue, but alas, it seems chrome's most recent update prevents you from doing this as well (Prompts you with a warning: 'Scripts may close only the windows that were opened by it'.)
Is there a way around this? I'm not talking about something along the lines of:
open(location, '_self').close();
But something that will work all the time on Chrome (e.g. changing a Chrome setting to allow scripts to close tabs/windows (similar to how this could be done through about:config
in Firefox) or a way of restructuring how the user hits the form, so that the window object is available in javascript so i can call windowObject.close();
) .
Thanks in Advance!