开发者

Disable javascript pop-up error

开发者 https://www.devze.com 2023-02-13 16:39 出处:网络
I have a Windows application where I use the WebBrowser control. The WebBrowser shows an html page created dynamically using javascript and xml.

I have a Windows application where I use the WebBrowser control. The WebBrowser shows an html page created dynamically using javascript and xml.

Thi开发者_JAVA百科s html page runs a new pop-up window. It works very well. But when I am closing the pop-up window I get the two errors:

  1. It was not possible to set value of property 'CpGetValue' value of object is Null or it isn't defined;
  2. It was not possible to set value of property 'CpSetValue' value of object is Null or it isn't defined.

I looked for these properties but I can't find them. I used the tips to disable JavaScript errors in the WebBrowser but I can't stop this error.


SLOPPY SOLUTION

If you have access to the html page and you can fix the javascript then do that. Otherwise, you might try the following.

Traverse the DOM of the webbrowser and inject the following javascript to attempt to suppress the errors:

<script>window.onerror=function(){return true;}</script> 

See: How to inject Javascript in WebBrowser control?


I had a problem awhile ago where I was using a WebBrowser control in a C# app and there was a link that created a pop-up window: the pop-up window did not maintain the same session/cookie data, so I ended up having to post the data I needed. It sounds like something like that could be causing problems for you, but there's not enough detail to tell.

0

精彩评论

暂无评论...
验证码 换一张
取 消