run scripts only on active tab

Bug reports and enhancement requests
Post Reply
zizi
Posts: 2
Joined: Tue Apr 21, 2009 5:09 pm

run scripts only on active tab

Post by zizi »

Is there chance this can works? I know NoScript has primary security purpose, but cpu load is also very annoying. Thanks.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)
User avatar
therube
Ambassador
Posts: 7971
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: run scripts only on active tab

Post by therube »

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16
zizi
Posts: 2
Joined: Tue Apr 21, 2009 5:09 pm

Re: run scripts only on active tab

Post 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...
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)
Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: run scripts only on active tab

Post 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.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US at an expert level; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 diehard
User avatar
therube
Ambassador
Posts: 7971
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: run scripts only on active tab

Post 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.)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16
Shemesh
Posts: 2
Joined: Tue Aug 04, 2009 6:45 pm

Re: run scripts only on active tab

Post 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!
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729) AutoPager/0.5.2.2 (http://www.teesoft.info/)
Post Reply