简体   繁体   中英

Prevent iFRame from reloading when an error occurs

I have successfully injected an iframe( its source is https://google.com ) to an HTML page dom using vanilla js. But, there are a number of errors arising from injecting the iframe to the DOM.

The most common error is

crbug/1173575, non-JS module files deprecated.
(anonymous) @ VM18962:7288
m=cdos,dpf,hsm,jsa,d,csi:3553 POST https://play.google.com/log?format=json&hasfast=true&authuser=0 400

But despite the error, if I am fast, I'm able to search for something on the google page being accessed by my iframe. however, less than a second later, right before it shows this error: crbug/1173575, non-JS module files deprecated. , the iframe RELOADS and goes back to the google homepage.

How do I stop the iframe from reloading or going to the previous page, despite the errors and warning?

Google does not permit https://google.com to be loaded through an iframe. That's the ultimate reason for that error you're witnessing.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

https://support.google.com/programmable-search/answer/4542055

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM