如何使用 Firefox 扩展注入 Javascript
我正在构建一个 Firefox 扩展,并且已经取得了很大的进展。 我的扩展的其中一个部分是在页面底部显示一个 DIV,并且我想将广告放入该 div 中,但由于某种原因,每次这样做时,它都会完全重定向到另一个页面,并显示广告它。 所以看起来它不允许我将下面的代码插入到位于底部的 div 中。 有机会有人可以帮忙吗?
这段代码当然会调用“ad_display.js”文件,这就是它执行重定向的地方。 有什么办法可以做到这一点还是我被困在水里了?
谢谢!!!
<!-- Beginning of Project Wonderful ad code: -->
<!-- Ad box ID: 38154 -->
<script type="text/javascript">
<!--
var pw_d=document;
pw_d.projectwonderful_adbox_id = "38154";
pw_d.projectwonderful_adbox_type = "2";
pw_d.projectwonderful_foreground_color = "";
pw_d.projectwonderful_background_color = "";
//-->
</script>
<script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script>
<!-- End of Project Wonderful ad code. -->
I am building a Firefox extension and have come a long way. One of the parts of my extension is where I display a DIV at the bottom of the page and I want to put an ad into the div, but for some reason every time it does so, it redirects to another page entirely with the ad on it. So it looks like its not allowing me to insert this code below into the div that sits at the bottom. Any chance anyone can help?
This code of course calls the "ad_display.js" file and thats where it does the redirect. Any way I can do this or am I stuck in the water?
Thanks!!!
<!-- Beginning of Project Wonderful ad code: -->
<!-- Ad box ID: 38154 -->
<script type="text/javascript">
<!--
var pw_d=document;
pw_d.projectwonderful_adbox_id = "38154";
pw_d.projectwonderful_adbox_type = "2";
pw_d.projectwonderful_foreground_color = "";
pw_d.projectwonderful_background_color = "";
//-->
</script>
<script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script>
<!-- End of Project Wonderful ad code. -->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两种解决方案:
Two solutions: