iOS移动端(H5)弹出框(alert/confirm)提示信息去除网址(URL)
alert:
<script type="text/javascript">
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);
};
</script>
confirm:
<script type="text/javascript"> window.confirm = function (message) { var iframe = document.createElement("IFRAME"); iframe.style.display = "none"; iframe.setAttribute("src", 'data:text/plain,'); document.documentElement.appendChild(iframe); var alertFrame = window.frames[0]; var result = alertFrame.window.confirm(message); iframe.parentNode.removeChild(iframe); return result; }; </script>
posted on 2017-05-15 13:35 Hibiscus_MO 阅读(1857) 评论(0) 编辑 收藏 举报