javascript - How to get window id of the popup window that is created by chrome.windows.create() -


how window-id of popup window created chrome.windows.create()

background.html

window_options={ "url":"another_popup.html" "type":"popup" };  chrome.windows.create(window_options,call_back_function) call_back_function(window window) { console.log(window.id)  //prints window's id } 

another_popup.html(the page popup window holds)

$(document).ready(function()  { console.log(window.id) //says ,cannot find property , gives null   }); 

there no such property window.id in javascript. however, have such property in callback function when using chrome api (chrome.windows.create) not associated javascript (javascript not recognize internal browser's identification system).

inside extension scope can use example chrome.tabs.getcurrent method retrieve information current tab. in callback function you'll have id. note id optional , may not set.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -