Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error using WebBrowser
Message
From
04/07/2014 05:57:45
 
 
To
19/07/2013 13:26:12
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01578896
Message ID:
01603231
Views:
72
>Hi All,
>My objective is to call a web application inside a vfp form. I am having an issue when using a web browser object.
>When navigating, depending on the web pages ( for example www.manex.com ), I will get an error ‘An error has occurred in the script on this page.
>Error: Unable to get value of the property ‘setStyle’: object is null or undefined
>URL http://www.manex.com/js/sl_slider.js
>
>the screen print of the error is attached.
>
>Here the code for duplicating the problem
>
>xx=Newobject('_webform',Home()+'\gallery\_WebView')
>xx.OleWebBrowser.Navigate2('http:\\www.manex.com')
>xx.Show()
>
>
>
>
>Help please.
>
>Thank you
>Yelena

Yelena,

A bit late but here it comes


Under the NavigateComplete2() event, put this
*** ActiveX Control Event ***
LPARAMETERS pdisp, url
=m.this.DisableScriptErrors()
The DisableScriptErrors() method looks like this
&& http://social.msdn.microsoft.com/Forums/en-US/addb47f6-ce7b-414b-8d2b-0840f945e211/disable-javascript-popup-error-in-webbrowser?forum=netfxjscript
&& http://stackoverflow.com/questions/153748/how-to-inject-javascript-in-webbrowser-control

local scriptText, jselement 
scriptText = 'window.onerror=function(){return true;}'

with this.document  

     jselement = .createelement('Script')

     jselement.type='text/javascript'
     jselement.text = m.scriptText 
    &&  jselement.id='vfpJsScript' && optional 

     .getelementsbytagname("head").item(0).appendchild(m.jselement)
endwith
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform