防止网页被嵌入框架的代码

    try{

      top.location.hostname;

      if (top.location.hostname != window.location.hostname) {

        top.location.href =window.location.href;

      }

    }

    catch(e){

      top.location.href = window.location.href;

    }

文章转载:https://www.ruanyifeng.com/blog/2010/08/anti-frameset_javascript_codes_continued.html

如果这篇文章对您有帮助,您可以打赏我

技术交流QQ群:15129679

原文地址:https://www.cnblogs.com/yeminglong/p/15000775.html