Catch X-Frame-Options Error in javascript

前端 未结 2 1227
你的背包
你的背包 2020-12-16 02:31

Is there any way to catch an error when loading an iframe from another domain. Here is an example in jsfiddle. http://jsfiddle.net/2Udzu/ . I need to show a message if I rec

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 03:16

    The onerror is applicable only for script errors. Frame content error checking must be done using any other method. Here's one example.

    
    
    

    Due to cross domain restriction, there's no way to detect whether a page is successfully loaded or if the page can't be loaded due to client errors (HTTP 4xx errors) and server errors (HTTP 5xx errors).

提交回复
热议问题