You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Userscript to handle sorry.google.com startups
Google's spam defenses appear to cause a problem with large Opera sessions. I think a script might be needed to fix it, but I don't know enough to write it myself. If anyone can help it would be good.When Opera opens a session, it sends requests for each tab opened to the relevant web server. Unfortunately (and not Opera's fault and not really Google's fault either), Google's webserver detects this mini-flood of google URLs as being automated query activity, and it redirects all such tabs in the existing session to sorry.opera.com. (The original query URL can be obtained from the "sorry" url via some basic regex manipulation.)
I don't think it will be possible to actually prevent this happening. If Opera has to open an existing session containing many Google search links, it's going to flood Google's server briefly and Google's server defenses will kick in and redirect them to the "sorry" page.
What might help is a userscript and button to tackle this a few ways:
- Userscript that detects if the page being loaded is google but not a "sorry" page. If it is, then it causes a random delay of up to 30 seconds on that tab, before actually loading it. Spreading them out over time might prevent their interpretation as spam.
- Userscript that acts when a page url is sorry.google.com. The script uses regex to recreate the correct URL from the sorry url, and then -
(a) After a random time of up to 60 seconds loads the correct URL; and/or
(b) Adds a "reload correct page" link to the page. - A button that a user can click to manually fix the issue during a session. It scans all loaded pages for "sorry.google.com". If it finds one, it converts the URL to the correct URL, loads that page instead, and then waits 3 seconds before continuing checking the rest of the tabs. This eventually reloads all affected tabs correctly for any affected pages, without triggering the sorry page.
I'm out of my depth here and new to scripting, but "Max Connections per server" doesn't solve it. It needs some kind of scripted handling or expert input. Help would be appreciated.
Thanks
Win 7 x64
Userscripts start running after the request was made, so I don't think the first one is possible.
The same applies to the third one, since userscripts are page-bound.
The second is probably quite doable, but I never get any sorry pages.
The same applies to the third one, since userscripts are page-bound.
The second is probably quite doable, but I never get any sorry pages.
The DnD Sanctuary — a safety net for My Opera's demise.
Originally posted by Frenzie:
Userscripts start running after the request was made, so I don't think the first one is possible.
I could be wrong but that was my impression.
Originally posted by Frenzie:
The same applies to the third one, since userscripts are page-bound.
But buttons aren't...?
Originally posted by Frenzie:
The second is probably quite doable, but I never get any sorry pages.
The "sorry" page is typically like this: http://sorry.google.com/sorry/misc/?continue=http://www.google.com/search%3Fhl%3Den%26safe%3Doff%26client%3Dopera%26rls%3Den-us%26hs%3Dtmz%26num%3D100%26q%3Dopera%2520blog%26btnG%3DSearch
Regex manipulation to remove "sorry.google.com/sorry/misc/?continue=" and replace %3F -> ?, %3D -> =, %26 -> &, %2520 -> space (etc) is all that's needed to get back the original URL.
An ideal userscript would detect if the URL is in the sorry.google.com domain. If so it adds a meta refresh to the correct URL with a random time interval, and adds a link after the "body" tag. That would be enough. (I can comment out either if it causes problems). It would be crude but workable.
Win 7 x64
Something along these lines...
(function () {
if( location.hostname.indexOf('sorry.google.com') != -1) {
var normalGoogle = decodeURIComponent(window.location.search).slice(10);
window.setTimeout(
function() {
window.location = normalGoogle;
}
,
Math.random() * 10000
);
document.documentElement.innerHTML += '<a href="' + normalGoogle + '">Search this shizzle on teh Google</a>';
}
})();
The DnD Sanctuary — a safety net for My Opera's demise.