【发布时间】:2016-12-06 06:19:18
【问题描述】:
我正在为我的网络应用程序开发一个 chrome 插件。
在这个插件中,我需要在页面右侧底部的其他网站页面中显示网络通知。
所以在这个网络通知中,我想使用 JQuery 在通知中显示 html 脚本。我试过下面的代码。
var jsonarray = JSON.parse(res);
var htmlData = '';
jQuery.each(jsonarray, function(v) {
name = jsonarray['name'];
img = jsonarray['img'];
pageurl = jsonarray['pageurl'];
Adata = '<div class="wtb-popup-opt" style="background-color: red;">'+
'<a class="wtb_popup_pd_plink" href="'+pageurl+'" target="_blank">'+
'<div class="wtb-popup-opt-pd wtb-popup-opt-o" wtb-tn="first">'+name+'</div>'+
'</a>'
'</div>';
htmlData = htmlData+Adata;
});
var title = 'Similar Products';
new Notification(title, {
icon: 'icon.png',
body: htmlData
});
上述代码中htmlData是html div内容。我想将此 html 内容显示到网络通知中。
谁能帮我在通知中显示 html 页面。
【问题讨论】:
标签: javascript jquery google-chrome google-chrome-extension google-chrome-app