Deny Google JS on www.google.com only

Discussions about the Application Boundaries Enforcer (ABE) module
Guest

Deny Google JS on www.google.com only

Post by Guest »

I recently tried disabling all JS from www.google.com and along with "Remove Google Tracking" and "No Google Analytics", search is fast like the good old days.

But I need to sometimes allow js from google.com for other other google apps. How do I?

Not working:

Code: Select all

Site *.google.com
Accept from *.google.com
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
Sandbox INC


Site www.google.com
Deny ALL
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Deny Google JS on www.google.com only

Post by barbaz »

I'm not sure of exactly what you want to do?
Assuming you want to allow google active content only on all google domains other than www.google.com:
allow google.com, gstatic.com, & googleapis.com, then use this ABE rule

Code: Select all

Site .google.com .googleapis.com .gstatic.com
Accept from ^https?://(?!www\.google\.com[/:])(?:[^/:]+\.)?google\.com[/:] .googleapis.com .gstatic.com
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
Sandbox
(Side note: you don't need No Google Analytics, because NoScript blocks Google Analytics completely if it isn't (Temp)Allowed.)
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Firefox/31.0
Guest

Re: Deny Google JS on www.google.com only

Post by Guest »

barbaz wrote:I'm not sure of exactly what you want to do?
Assuming you want to allow google active content only on all google domains other than www.google.com:
allow google.com, gstatic.com, & googleapis.com, then use this ABE rule

Code: Select all

Site .google.com .googleapis.com .gstatic.com
Accept from ^https?://(?!www\.google\.com[/:])(?:[^/:]+\.)?google\.com[/:] .googleapis.com .gstatic.com
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
Sandbox
This works but unfortunately prevents me from using this site, which requires google code for the captcha (why?).

How can I also disable Google cookies while using Google search?
I disabled the Google search tracking hiddens via user script:

Code: Select all

[].forEach.call(document.querySelectorAll("input[type=hidden]"),(e,d)=>{e.disabled=1})
barbaz wrote: (Side note: you don't need No Google Analytics, because NoScript blocks Google Analytics completely if it isn't (Temp)Allowed.)
The GA code was downloaded and run, so I got the extra plugin.
Last edited by barbaz on Sat Nov 29, 2014 8:04 am, edited 1 time in total.
Reason: fix quote tags
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Deny Google JS on www.google.com only

Post by barbaz »

Guest wrote:this site, which requires google code for the captcha (why?).
Add

Code: Select all

.informaction.com
to the Accept line
There are several threads here explaining what the deal is with google code and this board's recaptcha. Here's one viewtopic.php?f=8&t=12429
Guest wrote:How can I also disable Google cookies while using Google search?
I disabled the Google search tracking hiddens via user script:

Code: Select all

[].forEach.call(document.querySelectorAll("input[type=hidden]"),(e,d)=>{e.disabled=1})
Don't know if this will work but try

Code: Select all

Site www.google.com
Anonymize from about: chrome: file: SELF++
Guest wrote:
barbaz wrote: (Side note: you don't need No Google Analytics, because NoScript blocks Google Analytics completely if it isn't (Temp)Allowed.)
The GA code was downloaded and run, so I got the extra plugin.
On a site that has google analytics, go NoScript menu -> Forbid google-analytics.com, then NoScript menu > Untrusted > Mark google-analytics.com as Untrusted
Does that stop it from downloading?
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36
Guest

Re: Deny Google JS on www.google.com only

Post by Guest »

I was able to block cookies from Google web search by the following:

Firefox->Preferences->Privacy->Cookies->Exceptions

Code: Select all

www.google.com 
[x] block
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
Guest

Re: Deny Google JS on www.google.com only

Post by Guest »

Now I realize that I need JavaScript for Google Maps, which starts with the same hostname.

https://www.google.com/maps?q=Nicaragua+map

I want to block www.google.com/[b]search[/b].

But the NoScript strategy given prevents the map from loading. Please show me how can I allow maps js work, but not search.
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Deny Google JS on www.google.com only

Post by barbaz »

try

Code: Select all

Site .google.com .googleapis.com .gstatic.com
Accept from .google.com/maps?* ^https?://(?!www\.google\.com[/:])(?:[^/:]+\.)?google\.com[/:] .googleapis.com .gstatic.com
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
Sandbox
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (compatible; Konqueror/4.3; Linux) KHTML/4.3.1 (like Gecko) Fedora/4.3.1-3.fc11
Guest

Re: Deny Google JS on www.google.com only

Post by Guest »

Google maps won't load. But it isn't just necessarily maps that I want. I want to block js from Google websearch. I've created a user script to filter out the hiddens, so the URL looks like this:

Code: Select all

https://www.google.com/search?q=P%26G&btnG=
— where `P%26G` can be anything

Code: Select all

"https://www.google.com/search?q=P%26G&btnG=".match(/(\?q=[^&]+)&/)[1]
"?q=P%26G" 
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Deny Google JS on www.google.com only

Post by Thrawn »

Guest wrote:I want to block js from Google websearch.
You could just block that, then?

Code: Select all

Site ^https?://www\.google\.com/search.*
Deny
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0
Guest

Re: Deny Google JS on www.google.com only

Post by Guest »

No that doesn't work, Thrawn. That blocks the site itself. How can I search google without javascript?

I also tried:

Code: Select all

Site ^https?://www\.google\.com/search?q=[^&]+&btnG
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
More guesswork.

I want to have "block/allow google.com for this site"
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Deny Google JS on www.google.com only

Post by Giorgio Maone »

Just

Code: Select all

Site ^https?://www\.google\.com/search
Sandbox
Should do the trick
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0
Post Reply