title: How to prevent javascript from running twice if same page is opened in two different tabs?
body: <p>I have a site made in php that calls a javascript file to check for site notifications and then send them as a browser notification (ie Mozilla's Firefox Notifications, Chrome Desktop Notifications, etc.). It works really well, and some users have asked for a chrome notification. I made a basic chrome notification that uses the same code, and it works great for when people aren't using the site. However, the problem is when they're both running at the same time. Users who are on the site and who are using the extension find themselves getting double notifications.</p>
  
  <p>Is there a way to make sure that neither one's code runs if the other is active?</p>
  
  <p>Thanks!</p>