Visual Basic run webbrowser with java

2.6k Views Asked by At

I'm trying to make a Runescape Client in Visual Basic, but when I run http://www.runescape.com/game in a web browser it tells me to install java

It brings up an error saying:

*An error has occurred in the script on this page.
line: 48
Char: 325
Error: Expected ')'
code: 0
URL: http://www.runescape.com/game
Do you want to continue running the scripts on this page?
(Yes/No)*

I need a way to run Runescape inside a visual basic Application.

Is there any way to add java to the web browser?

Any help would be appreciated :)

3

There are 3 best solutions below

0
On

It looks like you are getting this error, which is a JavaScript error on the page, not a Java error on your machine.

JavaScript error

To resolve, you need to clear the "Display a notification about every script error" check box in the Advanced section of the Internet Options menu. Here's a lengthy article on Microsoft Support describing how to access and change the Internet Options via VB.Net.

The relevant code from that page to access the Internet Options:

Public Sub InternetOptions()
    Dim cmdt As IOleCommandTarget
    Dim o As Object

    Try
        cmdt = CType(GetDocument(), IOleCommandTarget)
        cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.Options), _
        Convert.ToUInt32(SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o)
    Catch
        ' NOTE: Due to the way this CMDID is handled inside of Internet Explorer,
        ' this Catch block will always fire, even though the dialog
        ' and its operations completed successfully. Suppressing this
        ' error will cause no harm to your host.
    End Try
End Sub
0
On

This is due to a JS error, the easiest fix is to input in the Form load,

WebBrowser1.ScriptErrorsSuppressed = True

Hopefully that works?

0
On

just set the webbrowser ScriptErrorsSuppressed property to true and thats all