How to automatically highlight text on Firefox page source page?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,150
Reaction score
10,489
So we're using Firefox.

So take this page for example - https://www.blackhatworld.com/seo/any-idea-how-to-use-this-domain.1331104/

When you right-click somewhere on the page and click on "View Page Source," the page source page will open.

On the source page there's this text - "twitter:title"

But in order to see the text you have to scroll down.

Any way to auto-highlight text when the page opens?

---

I thought of greasemonkey, but the page source URL is like this - view-source:https://www.blackhatworld.com/seo/any-idea-how-to-use-this-domain.1331104/

See how it starts with "view-source"

Greasemonkey won't run on it. Plus I'd need a wildcard for my purposes, so something like this:

view-source:https://www.blackhatworld.com/seo/*

---

Any ideas how I can do it?
 
Sorry I don’t know, have you tried maybe Googling it?

Yeah a little bit. But ill look more into it tomorrow.

I thought maybe i can somehow have what i need from the page source be displayed on the actual page.

Ill sleep on it now :)
 
You can achieve that with JavaScript.
With this, you get the title.
document.querySelector("meta[property='twitter:title']").getAttribute('content')
And with this you change it.
document.getElementById("your-element-id").innerHTML = document.querySelector("meta[property='twitter:title']").getAttribute('content');
 
Last edited:
You can achieve that with JavaScript.
With this, you get the title.
document.querySelector("meta[property='twitter:title']").getAttribute('content')
And with this you change it.
document.getElementById("your-element-id").innerHTML = document.querySelector("meta[property='twitter:title']").getAttribute('content');

You mean with Greasemonkey?

Problem is, Greasemonkey can't run on pages that start like this:

view-source:https://www.blackhatworld.com/seo/any-idea-how-to-use-this-domain.1331104/

https://stackoverflow.com/questions/36784498/how-to-run-tampermonkey-in-a-view-source-page
I mean, maybe it's possible. Not sure. That's why I asked :)

Any ideas?
 
Ok so I figured this one out.

In this case, for some reason the website where I wanted this doesn't show you a certain stat when you're logged in, but it does show you the stat when you're not logged in.

So logged in = have to open page source to see the stat
Not logged in = you see the stat on the main page

Why it does this? Who the hell knows.

But I'll compromise and make my life easier by staying logged out of that site on my main browser, and that solves my problem.

Talking of compromises :D

 
https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-urlYou can use this on the URL of a web-page (I use this to interlink within my website with highlighted parts of text for SEO) to highlight certain text. I don't think it works with multiple occurrences of the text, but it'll at least jump to the first. With that done you can just use Ctrl+F

You can also set up a script for this. Ask for user input and highlight whatever was typed in after opening the url with this text added to the end of the page link using the above trick.


Edit: you can also add this user input to the clipboard for easy Ctrl+F.
 
https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-urlYou can use this on the URL of a web-page (I use this to interlink within my website with highlighted parts of text for SEO) to highlight certain text. I don't think it works with multiple occurrences of the text, but it'll at least jump to the first. With that done you can just use Ctrl+F

You can also set up a script for this. Ask for user input and highlight whatever was typed in after opening the url with this text added to the end of the page link using the above trick.


Edit: you can also add this user input to the clipboard for easy Ctrl+F.

Thanks man, but I already got the perfect solution to my problem here.

Well, not all the way perfect, but absolutely good enough :)
 
Back
Top