1

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:

  1. I can't modify formLoginSubmit (don't ask it's just a task I have to do)
  2. 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?

2
  • If you can't modify formLoginSubmit_custom and 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, change formLoginSubmit_custom to accept a callback and to call it when async operation complete. In the callback body, you'll change the location Commented Feb 1, 2014 at 14:30
  • This article may help you [enter link description here][1] [1]: stackoverflow.com/questions/1859185/… Commented Feb 1, 2014 at 14:34

1 Answer 1

0

Not possible. You would need to change formLoginSubmit to achieve that.

You could drop a cookie "do some work", and when page is reloaded, if you can execute some code - if you find a "do some work" cookie - you could execute that custom() logic in there. But that might not be useful for you depending on what you're trying to achieve.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.