ios alert弹出 去掉显示网址

来源:互联网 发布:ubuntu输入法切换设置 编辑:程序博客网 时间:2024/06/15 15:13

 ios 浏览器 alert弹出网址  解决办法

 以下是代码   直接 加上下面的js 就可以  当有alert方法执行的时候  就会自动调用  


<script>

  
  
  window.alert = function(name){
var iframe = document.createElement("IFRAME");
iframe.style.display="none";
iframe.setAttribute("src", 'data:text/plain,');
document.documentElement.appendChild(iframe);
window.frames[0].window.alert(name);
iframe.parentNode.removeChild(iframe);
}

alert("xxxx");


</script?

0 0