Reputation: 792
All I want to do is increment a COOKIE for each opened tab. Management of the COOKIE variable will be in PHP, I've sorted that out, but I don`t really know how to test if a new window has been opened (Javascript or Jquery). Any heads up? Thank you!
Upvotes: 1
Views: 226
Reputation: 14756
you cannot tell if a new window/tab has been opened from the server side. you can guess it however, by constantly sending a signal from an already open window to the webserver (e.g., ping the server from the page via ajax every X seconds).
edit:
if you only want to detect that a new tab has been on the client side only, there are several things you can do:
window.onbeforeunload
). Then, to check how many windows is currently open, you can read that field. Unfortunately, this won't work on lesser browsers like IE(6|7|8).Upvotes: 1