?
Solved

Javascript errors in VFP form using oleControl

Posted on 2014-03-14
9
Medium Priority
?
1,049 Views
Last Modified: 2014-03-18
So sample code to illustrate the problem.  When I try to navigate the olecontrol to a page that uses  javescript I get an error (see picture).  Not sure how to get the webpage to work properly in the oleControl. Any help would be appreciated.


ox = CreateObject("MyInternetExplorer")
ox.visible = .t.
ox.oweb.navigate("http://mintpal.com")
 
 
DEFINE CLASS MyInternetExplorer AS form
    ADD OBJECT oWeb AS CWeb
    caption = "My Internet Explorer"
    PROCEDURE init
        THISFORM.LEFT = 0
        THISFORM.WIDTH = SYSMETRIC(1) * 3/4
        THISFORM.height = SYSMETRIC(2)*3/4
        THIS.Resize
    PROCEDURE resize
        This.oWeb.resize
    
ENDDEFINE
 
DEFINE CLASS CWeb AS olecontrol
    oleclass = "Shell.Explorer.2"
    PROCEDURE Resize
        THIS.Width = THISFORM.Width - 10
        THIS.Height = THISFORM.Height - 10
    PROCEDURE Refresh
        nodefault
ENDDEFINE

Open in new window

scripterror.jpg
0
Comment
Question by:PeterHuppp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 42

Accepted Solution

by:
pcelba earned 2000 total points
ID: 39930179
Add following line before the Navigate method call:

ox.oweb.silent = .T.
0
 

Author Comment

by:PeterHuppp
ID: 39930331
Ok, I added the silent = .t. and it suppresses the error messages which is good.  But is there a way to allow the javascrypt to run and not generate the error in the first place?

Revised from above
ox = CreateObject("MyInternetExplorer")
ox.visible = .t.
ox.oweb.silent = .T. 
ox.oweb.navigate("http://mintpal.com")
READ EVENTS

Open in new window

0
 
LVL 42

Expert Comment

by:pcelba
ID: 39930364
It is difficult to write JavaScript code compatible to all existing browsers or browser OLE controls. It is similar like the FoxPro code running under various FoxPro versions...

Your only option is to ask the JavaScript code author for a fix.

Your web page example is not so bad. Some scripts do not run at all under certain browsers or they just freeze the browser...
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:PeterHuppp
ID: 39930588
so is nothing to be done to have it in a window inside a form that will work with javascrypt?
0
 
LVL 42

Expert Comment

by:pcelba
ID: 39931142
I wouldn't tell it so strictly... The JS code works inside the form in your case just some error messages are suppressed.
0
 

Author Comment

by:PeterHuppp
ID: 39932196
I've requested that this question be closed as follows:

Accepted answer: 0 points for PeterHuppp's comment #a39930331

for the following reason:

Although not a perfect solution it is working.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 39931225
Windows does not mean perfect World... And better (and cost effective) solution does not exist in this case.

BTW, why did you select your post as the solution?
0
 

Author Closing Comment

by:PeterHuppp
ID: 39932197
Not a perfect solution but not sure one is to be found.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 39938925
What was the javascript error anyway? It's an error in the javascript code, neither in VFP nor in IE, nor in the Webbrowser Control, it just shows there.

So either it's as simple as allowing javascript at all in you IE internet settings, or let the developers of mintpal.com fix it.

Bye, Olaf.
0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question