Skip to content

Instantly share code, notes, and snippets.

@pdokas
Created November 23, 2010 15:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdokas/711976 to your computer and use it in GitHub Desktop.
Save pdokas/711976 to your computer and use it in GitHub Desktop.
javascript:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28%27+s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random%28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20rid%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font-weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML%3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.length%20+%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid%29%5B0%5D.offsetTop%29%3B
@Shaxadhere
Copy link

How do i use this, u have any idea? and pls tell me if this works ok tho?

@pdokas
Copy link
Author

pdokas commented Dec 16, 2022

There are instructions on adding bookmarklets to a few browsers here: https://www.freecodecamp.org/news/what-are-bookmarklets/. Other browsers work just about the same, but you’ll have to figure it out.

And this still seems to work.

@Shaxadhere
Copy link

I was looking for "Find in page text with javascript" but I did it. Thanks anyways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment