最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - WPF browser InvokeScript - Stack Overflow

programmeradmin3浏览0评论

Does anyone know why I am getting (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) when attempting to invoke a javascript function in a WPF application (.Net 4)?

The browser control is hosted inside an application and is being used with local html files, e.g:

C:\Users\XXXX\AppData\Roaming\XXXX\Books\XXXX_revision_1_1\html\1\med-9780198569244-chapter-4

This file has a javascript include - 'script/scripts.js'

Is it possible from C# to execute a javascript function using the InvokeScript method on the browser control when url is a local file?

Does anyone know why I am getting (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) when attempting to invoke a javascript function in a WPF application (.Net 4)?

The browser control is hosted inside an application and is being used with local html files, e.g:

C:\Users\XXXX\AppData\Roaming\XXXX\Books\XXXX_revision_1_1\html\1\med-9780198569244-chapter-4

This file has a javascript include - 'script/scripts.js'

Is it possible from C# to execute a javascript function using the InvokeScript method on the browser control when url is a local file?

Share Improve this question asked Jul 9, 2011 at 17:46 AwkwardCoderAwkwardCoder 25.7k29 gold badges86 silver badges160 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

The simple answer was, I was calling it to early, it has to be after the page has loaded.

as stated in MSDN - http://msdn.microsoft./en-us/library/cc491132.aspx

'InvokeScript(String) should not be called before the document that implements it has finished loading. You can detect when a document has finished loading by handling the LoadCompleted event.'

发布评论

评论列表(0)

  1. 暂无评论