我正在尝试使用 csharp 为 Internet Explorer 浏览器开发一个插件,并尝试将 javascript 注入到加载的页面。要注入 javascript,我使用了以下代码。代码被注入并且警报工作正常。但下面给出的代码应该将“msg”的值返回到输出。当我运行此代码时,我得到空值作为输出。请帮助。
var output= HTMLDocument.parentWindow.execScript("msg()","JScript");
function msg(){
var msg = "This is sample";
alert(msg);
return msg;
}