After login I have function which gets control.
function formLoginSubmit() {
if (typeof window.formLoginSubmit_custom != 'undefined') {
window.formLoginSubmit_custom();
}
location.href = '/';
}
And in function formLoginSubmit_custom() I have to do some operations with opening Iframes.
The problem is that:
- I can't modify
formLoginSubmit(don't ask it's just a task I have to do) - Before I've done all operations with my iframes document starts redirecting
because of this:
location.href = '/';
So how can I stop executing code asyncronously
And let my formLoginSubmit_custom() function finish all the operations before changing
location.href
What are my options?
formLoginSubmit_customand it is performing async operation, you are in trouble... The only thing you can do is schedule the location change with setTimeout and hope formLoginSubmit_custom has complete. Otherwise, changeformLoginSubmit_customto accept a callback and to call it when async operation complete. In the callback body, you'll change the location