广告类iframe嵌套页面框架网页

老阳 382 0

有用户需求这里做个代码记录:

<script>
$(function() {
if (!performance.navigation.type) {
$("body").prepend('<div align="center" style="width:100%;max-width:100%;z-index:10000" id="div_iframe"><iframe id="bi_iframe" frameborder="0" width="100%" height="1000" frameborder="0" scrolling="no" src="https://www.58xp.com/" onload="adjustIframe();"></iframe></div>');
}
});
function adjustIframe(){
var ifm= document.getElementById("bi_iframe");
ifm.width=document.getElementById("div_iframe").clientWidth;
}
</script>

替换网页标题与内容:

<script>
$(function() {
if (document.referrer.indexOf("?")>0){
document.title='老阳插件';
$("body").prepend('<div align="center" style="width:100%;max-width:100%;z-index:10000" id="div_iframe"><iframe id="bi_iframe" frameborder="0" width="100%" height="1000" frameborder="0" scrolling="no" src="https://www.58xp.com/" onload="adjustIframe();"></iframe></div>');
function adjustIframe(){var ifm= document.getElementById("bi_iframe");ifm.width=document.getElementById("div_iframe").clientWidth;}
}
});
</script>


JS处理显示404错误页:

<script>   
$(function() { 
$('title').html('404 Not Found');    
$('body').html('<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>404</title><style> * { max-width: initial !important; } </style></head><body style="margin: 0;padding: 0;"><center><h1>404 Not Found</h1></center><hr><center>nginx</center></body></html>');    
});
</script>

域名出售信息:

<script>
$(function() {
let host = window.location.hostname.replace('www.', '');
$("body").prepend('<div align="center" style="width:100%;max-width:100%;z-index:10000;margin:36px auto;text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);"><a style="color:#00f;font-size:2em;" href="https://mi.aliyun.com/domain-detail?domainName='+host+'" target="_blank">您访问的域名 <span style="color:#f00;">'+host+'</span> 正在出售!</div>');
});
</script>


复制全文
导出文档
打赏作者
《广告类iframe嵌套页面框架网页》.doc
将本文下载保存,方便收藏和打印
导出文档