0

I have a page with a web browser control within a WP 8.1 app. Is there a way to inject a JS script when open a page with it. I have the JavaScript file in my solution dir, and I'll read it like a string maybe?

v.g.
  • 1,076
  • 5
  • 19
  • 38

1 Answers1

0

Yes you can easily inject JS script to document. Look at these links:

How to inject Javascript in the WP7 WebBrowser control?

http://www.jayway.com/2014/03/10/windows-phone-8-native-and-javascript-interop/

If you have your script in solution you can load it and inject to browser.

Community
  • 1
  • 1
razor118
  • 473
  • 4
  • 16
  • These links are for WP7 and WP8, but not WP8.1 – v.g. Nov 09 '15 at 08:37
  • Yes but API is very simillar in WP8.1 for Windows Runtime. InvokeScript is still available. Look here: https://msdn.microsoft.com/pl-pl/library/windows/apps/windows.ui.xaml.controls.webview.aspx – razor118 Nov 09 '15 at 08:40