【发布时间】:2012-11-06 23:58:16
【问题描述】:
我创建了我的第一个 BHO,一个 IE 插件。我想向头部注入一个javascript文件。
IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)document.all.tags("head")).item(null, 0);
IHTMLScriptElement scriptObject = (IHTMLScriptElement)document.createElement("script");
scriptObject.type = @"text/javascript";
scriptObject.text = "\nwindow.onload = function(){alert('loaded..');}\n\n";
((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);
这很好用,但我想使用:scriptObject.src 并链接到我添加到项目中的资源文件。我尝试使用 RES: 协议,但 IE 找不到它。我这样做正确吗?谢谢。
scriptObject.src = "res://C:/git/addon/ie/bin/addon.dll/script.js";
【问题讨论】:
标签: c# visual-studio-2012 bho