I'm trying to modify a webpage I access that has a table with a bunch of rows. I'd like to loop through and compare a name in that row with a name on another list I have, if it's there make that name in the table red. I don't have any code yet, but I'm lost when it comes to figuring out how to run this code when I run the webpage in my chrome browser. Does anyone have an example or tutorial about how to do this? Most posts on this topic are many years old and it's been hard to find this info. I appreciate your help!
-
1you can run arbitrary js in the chrome consolestjns– stjns2020-03-05 23:02:03 +00:00Commented Mar 5, 2020 at 23:02
-
someone asked this check the answers stackoverflow.com/questions/6657229/… I hope this will helpsohib shaheen– sohib shaheen2020-03-05 23:08:01 +00:00Commented Mar 5, 2020 at 23:08
-
Tampermonkey extensionepascarello– epascarello2020-03-05 23:50:53 +00:00Commented Mar 5, 2020 at 23:50
-
Have a look at the Greasemonkey and the Tampermonkey browser extensions They might allow you to do what you want.Stephen P– Stephen P2020-03-05 23:55:56 +00:00Commented Mar 5, 2020 at 23:55
1 Answer
It sounds like what you're trying to do is modify the structure of a webpage you don't own the code to. While you can use the developer tools to run arbitrary JS, that becomes tedious to do every single time.
I think what you want is a browser plugin. Check out the resources below:
Chrome: https://developer.chrome.com/extensions/getstarted
Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension
There may also be specific browser plugins already that let you run arbitrary JS code on certain pages, but I am not aware of any myself.