可以在webbrowser控件中嵌入javascript脚本吗?

时间:2016-09-17 15:46:22

标签: c# vb.net webbrowser-control

我试图以某种方式加载这个javascript

<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/744_RC08/embed_loader.js"></script> <script type="text/javascript"> trends.embed.renderExploreWidget("TIMESERIES", {"comparisonItem":[{"keyword":"programming","geo":"","time":"all"}],"category":0,"property":""}, {}); </script> 

我能想到的唯一方法是将其添加到html文档中并将其加载到webbrowser控件中,如下所示:

HTML DOC:

<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BODY>
<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/744_RC08/embed_loader.js"></script> <script type="text/javascript"> trends.embed.renderExploreWidget("TIMESERIES", {"comparisonItem":[{"keyword":"dominos pizza","geo":"","time":"all"}],"category":0,"property":""}, {}); </script> 
</BODY>
</html>

代码:

WebBrowser1.DocumentText = IO.File.ReadAllText("C:\Users\Zach\Desktop\test.html")

看起来很简单,但根本没有任何负载。 这是不可能的还是有更好的方法来完成我想做的事情?

0 个答案:

没有答案