On popup page has a function chrome.tabs.create, and background page has chrome.tabs.onCreated.addListener,and there is chrome.tabs.getSelected in onCreated.addListener, i don’t understand why the code can’t go on without the alert . The code is like that
$(document).ready(function() { chrome.tabs.onCreated.addListener(function() {
alert("Login"); //without this can not go on.only click the alert can work
$("#dialog").dialog("open");chrome.tabs.getSelected(null,function(tab) {chrome.tabs.sendRequest(tab.id,
The alert is not withholding execution of rest of the code. What you must be experiencing is the change in browser UI before you click “OK” on the alert. That is actually feature of the chrome. Before you resolve an alert, you will see no changes in browser’s UI (like new tabs being created, tabs getting rearranged, etc..)