Ask HN: Is there a way to stop Google hijacking the URL?

9 points by anigbrowl ↗ HN
On many pages I visit now, clicking on a search result from google takes me to

https://someurl.tld/page-I-want/#:~:text=Text%20I%20never%20asked%20for

where the appended portion is the text fragment that shows up in Google's search result under the URL. It's incredibly annoying as I'm having to suddenly hand-sanitize every URL if I get it from Google. I use other search engines like DDG where possible but it's not always possible or practical.

6 comments

[ 3.8 ms ] story [ 21.2 ms ] thread
You could use another search engine. Though, if you really want to use google you can open the article in another tab. That should give you the correct url.
I don't believe it is, your best bet right now is to change to another browser.
I just use this:

  let p=document.evaluate("//a",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  var w,x;
  for(var i=0;i<p.snapshotLength;i++) {
    w=p.snapshotItem(i);
    x=w.getAttribute("href");
    x=x.replace(/^\/url\?q=([^&]*)&.*$/,(y,z)=>unescape(z));
    w.setAttribute("href",x.replace(/[?&]?sa=[A-Z]&ved=[-A-Za-z/._0-9+]*$/,""));
  }
There are some addons for Firefox to clear the urls. My advice is to not use Google.