if (document.cookie.indexOf("_ptt=") < 0 ) {

  chrome.tabs.getCurrent(function(tab) {
    if (tab) {
      return;
    }
    // Move authorization process to new tab!
    chrome.tabs.create({url: document.URL});
  });
}

if (document.cookie.indexOf("_ptt=") < 0 &&
  typeof chrome !== 'undefined' ) {

  chrome.tabs.getCurrent(function(tab) {
    if (tab) {
      return;
    }
    // Move authorization process to new tab!
    chrome.tabs.create({url: document.URL});
  });
}

Fix JS error chrome is undefined
Fix JS error chrome is undefined
