Closed csagan5 closed 6 years ago
When I view the source of https://encrypted.google.com/search?q=test (with view-source / with the devtools), I don't see the contextmenu (in Chrome / Firefox). How can I get the "oncontextmenu" attribute to appear?
@Rob--W I see it on mobile, but on an actual Chrome/Chromium/Bromite via adb dev tools remote inspection
I ended up using a simplified version of your content script and I am adding AMP search results removal too; I'll publish that part of the patch as soon as it builds successfully and it's tested.
Thanks for the patch and instructions.
When I use desktop Chrome browser and emulate the "Nexus 6P" in the device toolbar, with JS enabled, then I see the following when I search for "example.com":
<a
href="http://www.example.com/"
ping="/url?...&url=http://www.example.com/&..."
oncontextmenu="google.ctpacw.cm(this)">
And google.ctpacw.cm
is:
function (a) {
a.ping && (a.href = a.ping, a.removeAttribute("ping"))
}
The oncontextmenu
handler indeed attempts to rewrite the href
of the link. However your patch does not prevent that from happening because removeAttribute('oncontextmenu')
is only called when an onmousedown
attribute is present (and this is not the case).
The code (at Google) shows to me that my extension is working as intended, because I intercept the attempt to set the href
and assign the actual URL instead:
Google search results' hyperlinks also contain now the
oncontextmenu
attribute, calling some internal JS function.By the way, I have successful integrated your
contentscript.js
in Bromite and it will be released in next version.