最近在开发Hybrid APP时发现用系统默认的alert弹出框总会带有域名,用户体验就比较不好了。想了一种办法来解决就是覆盖alert的方法。

(function(){
       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);
}
  })();

完美解决!

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-09-17
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案