0

I have a website that uses bootstrap and I am accessing the website through a wpf form using the web browser control.

When I navigate to certain pages I get a script error window that says Invalid operand to instanceof: Function expected

script error window

The WPF form is my way of recreating a client's application where this same issue is occurring.

I can only change the html of the site , has anyone experienced this and found a solution ?

Is there a way to turn on debugging so i step thru and find what is calling the code

Has anyone specifically experienced something like this with the wpf browser control, and how did you get past it?

Rick Hodder
  • 2,189
  • 3
  • 26
  • 54
  • Sounds like bootstrap is missing a function. Are you sure all scripts needed by bootstrap are loaded? Like jquery.js? Does it work on other browsers? – Jeroen Doppenberg Aug 11 '16 at 07:26
  • the site works in IE and chrome – Rick Hodder Aug 11 '16 at 14:38
  • Did you check the html if jquery.js or jquery.min.js is loaded? I think it needs to be loaded before bootstrap – Jeroen Doppenberg Aug 11 '16 at 14:39
  • Just checked: jquery is being loaded before bootstrap – Rick Hodder Aug 11 '16 at 14:42
  • Then i suggest to debug the javascript and see when exactly the error is occuring. Use the developer tools. In chrome press F12 en click tab source. Reload the page where the error is and look for an exception or message. If the error is inside the boorstrap(which you don't want to debug) try looking at the stacktrace and check out where in your code it initiated. – Jeroen Doppenberg Aug 11 '16 at 14:55
  • Thanks for the suggestion, unfortunately the developer tools cannot be opened in the web browser control on the wpf form. I'm starting to dig into bootstrap js – Rick Hodder Aug 11 '16 at 15:04
  • I have one more idea. Find out what version of IE wpf is using as browser or set it yourself(http://stackoverflow.com/questions/23776951/set-wpf-webbrowser-control-to-use-ie10-mode). If the error is still there try to emulate the browser version in your internet explorer en debug that way. – Jeroen Doppenberg Aug 11 '16 at 15:14
  • Not working, thanks for the ideas - hopefully someone who has experienced this with the wpf control can chime in – Rick Hodder Aug 11 '16 at 19:20

1 Answers1

3

I figured it out: I stumbled across an entry on Rick Strahl's weblog (https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version) about the web browser control, and in one of the comments, a commenter said that he tried adding the following meta tag to the page:

<meta http-equiv="X-UA-Compatible" content="IE=11" /> 

So I put that in the master page of my application, and everything worked!

Rick Hodder
  • 2,189
  • 3
  • 26
  • 54
  • hmm, the fix worked under IISExpress, but when I deployed the site to the internet, it fails as mentioned above. Time to put on the mining helmet and dig down further. – Rick Hodder Aug 12 '16 at 16:23
  • interesting - the web forms app when running under IIS encoded the meta tag's content attribute, and so it said content="IE==11" - modified the site to render it properly, and now it works! – Rick Hodder Aug 15 '16 at 17:04