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

203
Views
href with "javascript" doesn't work in iframe

I have page.html where there is following code:

<iframe srcdoc="&lt;a href=&quot;javascript:console.log(1)&quot;&gt;test&lt;/a&gt;" sandbox="allow-same-origin || allow-scripts || allow-top-navigation || allow-popups"></iframe>

I allow scripts, top-navigation and popups. When I load page.html in browser(Firefox Lastest), I can see hyper-link test in iframe, but here is the problem: when I click it - nothing appears in console(F12) while following code:

<iframe srcdoc="&lt;script&gt;console.log(1)&lt;/script&gt;" sandbox="allow-scripts || allow-top-navigation || allow-popups"></iframe>

Outputs "1" in console. Why wouldn't the javascript in a href work?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  • You missed some code in your href (javascript:...)
  • allow-same-origin: If this token is not used, the resource is treated as being from a special origin that always fails the same-origin policy. see MDN doc here
about 4 years ago · Juan Pablo Isaza Report
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!