Page 1 of 1

run scripts only on active tab

Posted: Tue Apr 21, 2009 5:15 pm
by zizi
Is there chance this can works? I know NoScript has primary security purpose, but cpu load is also very annoying. Thanks.

Re: run scripts only on active tab

Posted: Tue Apr 21, 2009 5:33 pm
by therube

Re: run scripts only on active tab

Posted: Tue Apr 21, 2009 5:47 pm
by zizi
I understand.. but I want to know if it is possible. I mean dynamically switching - scripts run only on active tab. There are only few cases when you need running script on "background" = inactive tab - (counters, calculations, ..) and it can be solved with exceptions...

Re: run scripts only on active tab

Posted: Thu Apr 23, 2009 5:30 am
by Tom T.
zizi wrote: cpu load is also very annoying. Thanks.
I'm not seeing that CPU load on inactive pages. For example, while keeping this window open, I opened YouTube, a fairly "heavy" site, in a new tab. There was a split-second CPU spike to 100%, to load the page as fast as possible. But now, with that tab inactive as I type this, CPU usage is varying from 0-10%, mostly from my typing. When I stop typing for a while, it mostly stays in the 0-4% range. So I'm not seeing that having YouTube in an inactive tab (with its scripting allowed) is costing anything.

I tried revoking YouTube's permissions. Momentary spike as page reloads. Re-allowed. Another momentary spike, then calm down.

Are you running online gaming, stock tickers, etc. in your inactive tabs? What exactly is causing your CPU usage once the page *and its scripts* have already loaded? Is it an old, slow processor? Mine is 1.6 GHz, which isn't much these days. Cheers.

Re: run scripts only on active tab

Posted: Thu Apr 23, 2009 1:23 pm
by therube
Say JavaScript is blocked for a particular domain.
And you have 5 separate windows (or tabs) open for that domain.
If you need JavaScript in only one of those windows, so you go to it, Allow the domain, refresh the page.
At that point, for that one page, JavaScript is active.
The other 4 pages, even though their icons will show Allowed, but because the page has not been refreshed, JavaScript is still not active for those pages.

So in that respect, in some approximation, you are running scripts only on that one page.

(This is assuming that you are not automatically refreshing all pages in a domain.)

I do this all the time with Bank of America. I login, & review my accounts with JavaScript disabled. When I go to Online Bill Pay, I (now) enable JavaScript for that tab. (Used to be most functions would work without JavaScript, but they changed that recently forcing you to enable JavaScript. Sucks, but not as much of a hindrance as it is in Online Banking itself.) If I go to the Transfers section (which I open in a tab too), I'll enable JavaScript for Transfers (as it is kind of needed there). Further, at some point, I'll usually go back to one of the "banking" screens (where JavaScript was initially blocked, but currently may show Allowed) & Forbid it once again. Doing so allows me to have all my windows open without having BoA's timeout feature kick in. That allows me to review my account data for an extended period of time. (Note that regardless, at some point, I will actually time out, whether I've been "notified" of that fact or not.)

Re: run scripts only on active tab

Posted: Tue Aug 04, 2009 7:04 pm
by Shemesh
I support this request totally. It's one of the top enhancements I would love to see to make noscript an even better tool!

My work involves a lot of research and I often have open 100 concurrent tabs in Firefox. When I close Firefox / restart my PC the tabs are restored which is great for my job. I use Tab Kit to expand / collapse the tabs in tree form so it is manageable.

Before I used noscript the accumulated java scripts on all those background tabs "spinning their wheels" used 100% of my CPU capacity, a very bad result. It wasn't due to any one website. After installing noscript and disabling all scripts, CPU fell to under 5%, a great result. However, I now have to keep enabling / disabling scripts or granting / revoking temporary rights to enable some of my tabs to work and this is really too frustrating.

What I would like to have is a new option to allow disabling of all bacground tabs. Better still, instead of a setting to allow / forbid scripts by website it wold be great to have the setting give a third option - allow always / allow on foreground tab only / forbid always. This would be in addition to options to grant temporary permissions and the global options. Maybe provide an additional option to disable scripts on all tabs on background or minimised windows, where multiple firefox windows are currently opened.

Please make my day!