跨域下使用获取iframe的父页面URL
作者:Kinglong
发表时间:2023-07-16 06:03
关键词:
通过parent !=window检测iframe与父页面是否同源。
当同源时,使用parent.location.href或者top.location.href。
当不同源时,使用document.referrer。
通过parent !=window检测iframe与父页面是否同源。
当同源时,使用parent.location.href或者top.location.href。
当不同源时,使用document.referrer。