admin管理员组文章数量:1421549
So I'm using Gritter for notifications throughout a site, and was wondering if there was a simple way to intersept all the alert() s thrown by any script, with jQuery, and reformat the value of the alert to the body of a Gritter notification?
So I'm using Gritter for notifications throughout a site, and was wondering if there was a simple way to intersept all the alert() s thrown by any script, with jQuery, and reformat the value of the alert to the body of a Gritter notification?
Share Improve this question edited Jun 28, 2011 at 6:50 stealthyninja 10.4k11 gold badges54 silver badges60 bronze badges asked Jun 28, 2011 at 5:36 user811348user811348 811 silver badge9 bronze badges1 Answer
Reset to default 8You can replace the alert
function and do whatever you want with the arguments:
window.alert = function (message) {
$.gritter.add({
title: 'Message for you sir!',
text: message
});
};
本文标签: javascriptIntercept and convert all alerts to notificationsStack Overflow
版权声明:本文标题:javascript - Intercept and convert all alerts to notifications - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745331807a2653850.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论