Chrome API - Making active tab go back in history more than once -
i'm trying chrome extension make active tab go in history more once.
why code make active tab go once, instead of 5 times, it's supposed to?:
gobackonepage(0); function gobackonepage(count) { // active tab in current window. chrome.tabs.query({ 'active': true, 'lastfocusedwindow': true }, function(tabs) { var activetabid = tabs[0].id; // execute history.back() script on active tab. chrome.tabs.executescript(activetabid, { code: 'history.back();' }, function(result) { // recurse 5 times. if ( count++ < 5 ) { console.log(activetabid); // gets logged 5 times (recursion working) gobackonepage( count ); } }); }); }
the active tab goes 1 page, no more. log gets called 5 times , logs exact same active tab id 5 times. why doesn't active tab go 5 times? tried wrapping recursive call in settimeout method (500ms) , created thread-pausing method (essentially), same problem.
Comments
Post a Comment