Question

I am currently trying to open tabs in chunks with a loop and a recursive call of a function:

open_pix : function()
{
    ...

    for (i=start; i <= rounds; i++) 
    {
        window.open(mp_op.xpathResult.snapshotItem(i).getElementsByTagName("a")[0].href,'');
    }

    ...

    if (flag)
    {
        var t = window.setTimeout( mp_op.open_pix, mp_op.timeoutMS );
    }

Unfortunately my script stops working completely after it has opened the first chunk of tabs. I assume that the script is killed after the browser loaded new tabs, but this can't be right because it would have stopped after the first opened tab.

So what did I do wrong again ?

No correct solution

OTHER TIPS

do it in this way

   open_pix : function()
    {
        ...
        opner : function () {
           for (i=start; i <= rounds; i++) 
          {
            window.open(mp_op.xpathResult.snapshotItem(i).getElementsByTagName("a")[0].href,'');
          }

           ...

           if (flag)
           {
             var t = window.setTimeout( mp_op.open_pix, mp_op.timeoutMS );
           }
         }
      opner();
    }

so after the open_pix finish exacting the opner function keep work "closures"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top