0

For instance, when I follow a google link to the page: https://en.wikipedia.org/wiki/Definiteness#:~:text=In%20linguistics%2C%20definiteness%20is%20a,not%20(indefinite%20noun%20phrases).

It highlights a segment of text on the page to show me where the search paragraph text was pulled from (or something similar to that idea, if not it exactly). I find this marginally useful, so I don't want to disable the feature completely, as most extant search results about this feature desire to. Instead I would like to be able to clear the highlighting with a hotkey once I'm on the page, because it can often (as is the case on Wikipedia) obscure semantic formatting on the page, such as which words in the highlighted texts are links.

Workarounds which I am aware of but not asking for:

  1. Manually removing the Text Fragment from the URL and reloading the page (unergonomic per Fitts's law)
  2. Disabling Text Fragments on my browser settings (I find them broadly useful bar this one inability)
  3. User script to implement this myself (trying to avoid this if possible, can't imagine it's trivial to get it to work on every website in an optimal way)

This also seemed to be (at the time) a very "hard to search for" problem (at least with google), so this question hopefully also serves as a locus of SEO for the problem of unhighlighting url text fragments, and can maybe be updated at a future date if a hotkey springs into existence for various browsers.

1 Answer 1

1

You can use AutoHotkey script for this:

^+0::
; Select text in address bar with Ctrl + L shortcut, wait a bit
Send ^l
Sleep 300
; Copy the text
Send ^c

; Replace the last :~:text= part in clipboard
Clipboard := RegExReplace(Clipboard, "i)#:~:text=.+?$")

; Paste the text
Send ^v
; Go to the URL
Send {Enter}
Return

This assigns it to Ctrl + Shift + 0.

3
  • A valid workaround, but this requires the page to be reloaded (if only, optimally, from cache), and also clobbers one's place on the page and any other useful state one may have attained, so it's a bit displeasing. However I appreciate the work you did finagling the regex and ahk on my behalf. I do have an existing AHK "daemon" that contains various similar workarounds, but I think this problem might be better suited for a tampermonkey script that can contextually apply itself with a simpler hotkey (perhaps just, escape), if no first party solutions exist.
    – brubsby
    Commented Jun 2, 2023 at 1:26
  • You wrote you don't want an userscript. But I doubt one without reloading is too viable anyways. The highlights don't have anything added to the DOM, I'm quite sure there's no ID/class or any other selector for that. So if you remove background with none !important let's say, you could mess some regular styling up.
    – Destroy666
    Commented Jun 2, 2023 at 1:51
  • Fair points, I was operating on a likely overbroad definition of userscript that included ahk scripts, as they are both "second party" kludges that admit compromises in design. This question was primarily meant as a net to catch first party solutions as they came into existence, were none in existence at the time of writing.
    – brubsby
    Commented Jun 2, 2023 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .