简体   繁体   中英

Disable javascript pop-up error

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

This 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM