如何加载Javascript库以使其可用于WebBrowser控件中页面上的Javascript? [英] How do I load Javascript library to make it available to the Javascript on a page in a WebBrowser Control?

查看:71
本文介绍了如何加载Javascript库以使其可用于WebBrowser控件中页面上的Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要构建对MRAID兼容广告的支持,这些广告将显示在WebBrowser控件中. MRAID定义了23种方法和5个事件,广告设计人员可以从其JavaScript中使用这些方法和5个事件.所以,我需要建立一个图书馆 这23个JavaScript方法和5个JavaScript事件中.它们每个都将使用windows.external.Notify来调用C#函数,该函数将提供实际方法,并使用webBrowser.InvokeScript将请求的数据返回给JavaScript函数.

I need to build support for MRAID compliant ads that will be shown in a WebBrowser control.  MRAID defines a set of 23 methods and 5 events that are to be available for the ad designer to use from their JavaScript.  So, I need to build a library of those 23 JavaScript methods and 5 JavaScript events.  Each of them will use windows.external.Notify to call a C# function that will supply the actual method and return the requested data to the JavaScript function using webBrowser.InvokeScript.

所以困扰我的问题是如何加载我构建的JavaScript库,以便广告设计者可以使用这些功能?

So the question that has me stumped is how do I load the JavaScript library that I build so those functions are available to the Ad designer?

我唯一的想法是在将WebBrowser控件指向广告之前,动态解析广告的HTML并将JavaScript注入广告中,但这似乎非常笨拙且容易出错.

My only idea is to dynamically parse the Ad's HTML and inject my JavaScript into the Ad before pointing the WebBrowser control at it but this seems very clumsy and error prone.

您的想法和建议将不胜感激.

Your ideas and suggestions would be appreciated.

Dick

推荐答案

Dick,

可能是 此链接可以帮助您.

May be this link helps you.

最诚挚的问候.


这篇关于如何加载Javascript库以使其可用于WebBrowser控件中页面上的Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆