-1

I have a page at asp.net that is saving data at a regular time by javascript Set timeout function. But when I open another tab (means active tab1, tab2, tab3, my page tab (that is, not active)) on that moment my page stop saving data. I want to save data while my page is dative.What should I do? Thanks

Fameless
  • 345
  • 3
  • 17
ishtiaq
  • 49
  • 11
  • If the page isn't active the data will not change so it doesn't matter that it doesn't save when it is not active does it? – jasonwarford Feb 01 '16 at 19:30
  • chrome? http://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs – Nikki9696 Feb 01 '16 at 19:49
  • Sir actually the java script in my page is sending the coordinates of location at regular time and filling the text boxs where my timmer of ajax is saving it in database. but when this page is not active then it do not send. is there any way? thanks – ishtiaq Feb 01 '16 at 19:52
  • What browsers do you have to support? An option to keep the tab running active tasks in the background is using web workers. http://caniuse.com/#feat=webworkers – KevBot Feb 01 '16 at 19:56

1 Answers1

2

Well given your situation the only thing I can think about are WebWorkers. They run in a separate thread and are not interrupted if your page is not on the active tab. I would give you an example on how to use them in your situation but I think it's best if you read and try them yourself.

LE: As you can see on the page above, I hope you don't need to support older browsers than IE10. If you do, then the only way would be to detect when the tab is changed and save the location then (and loose the location when then tab is not active)

tudor.gergely
  • 4,800
  • 1
  • 16
  • 22
  • Sir Tudor thanks i will try as you guide. if get any problem then i will ask you again. thanks for reply. – ishtiaq Feb 02 '16 at 13:40