错误警报消息在Opencart模板中

时间:2015-02-17 10:32:58

标签: javascript php content-management-system opencart

我正在开发opencart项目的项目及其即将完成。我现在遇到一个问题。当用户点击其他Tab打开时。 Java正在显示警报错误消息。这是因为互联网速度很慢或页面未正确加载。我想删除该消息是否有任何方式我可以删除它或修复它。请帮我。 Here is the Link

2 个答案:

答案 0 :(得分:0)

要阻止商店发出的这种刺激性警报,请在网站标题中加入以下脚本。



<script>
(function() {
    var new_alert = window.alert;                  
    window.alert = function(str) {  //str variable return content which is passed to be shown in alert
    str1 = str.replace(/(\r\n|\n|\r)/gm,""); //Removing line break from string 
    if (str1 !="error"){ //show alert only if content is not equal to 'error'
    new_alert(str); 
} 
else{
    // do nothing
}
   };
})();
</script>
&#13;
&#13;
&#13;

如果您想知道它的作用: 它只是取代了javascript的默认提醒功能,并且在其内容为“错误”时不显示提醒。

答案 1 :(得分:-2)

Simpley使用

覆盖警报
<script>window.alert = function() {};</script>
相关问题