Is there a client-side way to detect X-Frame-Options?

后端 未结 8 712
温柔的废话
温柔的废话 2020-12-28 12:16

Is there any good way to detect when a page isn\'t going to display in a frame because of the X-Frame-Options header? I know I can request the page serverside and look for

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 13:02

    At least in Chrome, you can notice the failure to load because the iframe.onload event doesn't trigger. You could use that as an indicator that the page might not allow iframing.

提交回复
热议问题