Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Browser Extension: Attempting to replace page content and not working

I'm trying to get my extension to automatically change all content with "views" into "Views hidden" and something similar for "watching" (live streams), but when I run the extension it seems to do nothing. I'm thinking it might have something to do with me not knowing the permissions required or some other thing, but I can't seem to figure it out. This is my first time using javascript.

manifest.json

{"manifest_version": 2,
    "name": "SimplyWatch",
    "description": "Simply watch YouTube videos without any views, comments, or ratings data displayed for an experience unbiased by others' opinions.",
    "version": "1.0",
    "author": "Diamivore",
    "browser_action": {
        "default_icon": "tab-icon.png",
        "default_title": "SimplyWatch",
        "default_popup": "popup.html"
    },
    "permissions": ["activeTab", "tabs"],

    "content_scripts": [
        {
            "matches": ["<all_urls>"],
            "js": ["content.js"]
        }
    ]
}

content.js

const text = document.querySelectorAll('h1, h2, h3, h4, h5, p, li, td, caption, a, span')

document.addEventListener("DOMContentLoaded", function(){
    for (let i=0; i < text.length; i++) {
        if (text[i].innerHTML.includes('views')) {
            text[i].innerHTML = "Views hidden"
        } else if (text[i].innerHTML.includes('watching')) {
            text[i].innerHTML = "Watchers hidden"
        }
    }
});

Any help?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!