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

308
Views
chrome extension content script setTimeout throws error Blocked a frame with origin "X" from accessing a cross-origin frame

Chrome extension content script.

I am loading Jquery in the content script as following (the jquery file is contained within the extension pacakge):

"content_scripts": [
    {
        "matches": [
            "http://*/*",
            "https://*/*"
        ],
        "js": ["lib/jquery-3.6.0.min.js", "content.js"],
        "run_at": "document_idle"
    }]

I then try to run the following code in the content script (content.js):

    setTimeout(() => {
       $("span").each((el) => {
           console.log("****", $(this).text());
       })
    }, 2000)

Which ends with chrome throwing the following error:

DOMException: Blocked a frame with origin "https://" from accessing a cross-origin frame.

The weird thing is that if I dont use $(this) there is no problem. so for example the following would work fine without errors:

setTimeout(() => {
    $("span").text("asdasdasd");
}, 2000)

What am I missing here? I dont get the reasoning behind this and its driving me mad...

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!