11

I for some JavaScript code that execute per second. However it doesn't seam to run if the tab it is loaded on isn't selected.

Is this my code or is Javascript not capable of does it?

Also, if Javascript can run when it's tab is not selected could someone help me with the code to determine with it's parent tab is select or not.

Answers can be in pure Javascript or JQuery and solution will only need to work in IE7+

Thank you in advance.

I'm working on get the some code for you to look at. Cheers.

Seams there was an error in the code. Thanks for the knowledge that javascript will run though.

1
  • perhaps you have an onBlur="stop processing" functionality ? Commented Nov 8, 2010 at 11:49

2 Answers 2

5

Javascript should be running at the background. For browsers except Google Chrome, each tab is a thread and tabs should be able to communicate with each other too. For the chrome case, since every tab is a process, you may need to use inter-process methods for communication.

If you could provide your code we would be more helpful.

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

2 Comments

Lets say I have a recurring AJAX call. Is there a way to detect that a tab or window is not in focus and stop executing the JavaScript code?
I don't know if it is possible with javascript but in Firefox there is this "jetpack" project and it can detect tab focuses so by using it, it is possible i think.
0

JavaScript continues to run in the background. If it's not running, there should be some other reason. It would be helpful if you could give a code example to work with and work out what might not be happening.

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.