Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I can inject JavaScript in WebBrowser control in C# windows form by this link

How to inject JavaScript in WebBrowser control?

But I can't do this in WP7, please help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
477 views
Welcome To Ask or Share your Answers For Others

1 Answer

Unfortunately WebBrowser.Document is not available on WP7. But you can create and call a JavaScript function using InvokeScript. Have a look over here where I describe how.

In short: you don't use .Document and C# but create a piece of JavaScript instead. You then call eval with this script as parameter to invoke it. Like this:

webBrowser1.InvokeScript("eval", "  ...code goes here... ");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...