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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM