browserAction.onClicked.addListener(function(tab) { if (localStorage.getItem("url") == null) { var url = false; }else{ var url = localStorage.getItem("url"); } tabs.executeScript({ code: '' }); });