发表更新几秒读完 (大约106个字)
防止网页被嵌入框架的代码
为什么做防嵌入?
- 侵犯了作者的著作权,和访问者的知情权;
- 具有欺骗性极高的特点,利于不法用途;
- 容易被植入恶意脚本
使用防嵌入代码
1 2 3 4 5 6 7 8 9 10
| 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; }
|