1

I tried to make wait when open 4 websites until loading complete then get their title. For that I used readystate which didn't wait until load completes and gave Connecting as title. When I check in console the readystate gives undefined. Below is my code.

The sdk I am using is 1.17 and ff is 36.0.4.

var tabs = require("sdk/tabs");
tabs.open("https://developer.mozilla.org");
tabs.open("http://www.nytimes.com/");
tabs.open("http://en.wikipedia.org/wiki/Main_Page");
tabs.open("https://www.google.co.in");

for (let tab of tabs)
{
  console.log(tab.title + tab.readystate);
};
4

1 回答 1

0

Got it! At last I made it work by replacing

for (let tab of tabs)
{
console.log(tab.title + tab.readystate);
};

with

tabs.on('ready', function(tab) {
 console.log('tab is loaded', tab.title, tab.url, tab.readyState);
});

as explanation about 'readystate' in https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs#activate_2

Thank you for everyone whoever trying to get a solution for this in the meantime.

于 2015-03-28T10:58:17.613 回答