You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Dani

Intermediate

  • "Dani" started this thread

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

1

Friday, November 4th 2011, 4:23pm

open a link with default browser

Hey everybody,
in order to open a link to a web page from within my Jabaco progs with the default browser I am using the 'Bare Bones Browser Launch solution'

Quoted

The Bare Bones Browser Launch solution is appropriate when a compact lightweight method to open a web page is needed. Bare Bones is free and works on Mac OS X, GNU/Linux, Unix (Solaris), and Windows XP/Vista/7. ...
It will attempt to use the Desktop library from Java 6 but fall back to system calls if the library is unavailable.


It is quite reliable and very easy to use:

Jabaco Source

1
BareBonesBrowserLaunch.openURL("http://www.jabaco.org")


Press F1 in your Jabaco window and add the bare-bones-browser-launch-3.1.jar to your project.


Dani

JasonS

Trainee

  • "JasonS" is male

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

2

Saturday, November 5th 2011, 9:46pm

This works well via Jabaco runtime, however, applet at run time via web browser returns an error and does not execute.

Message
Error attempting to launch web browser
java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)


I have the below the code to work the exact opposite, to -work- via browser, but -not- jabaco runtime. Go figure, lol.

Also don't forget to add java#net in resources for it to work.

Jabaco Source

1
2
3
4
5
6
Dim url As java#net#URL
Dim s As String

s = "http://www.google.com/"
url = New java#net#URL(s)
Me.Parent.getAppletContext.showDocument(url,"_newtab")


Greetings,
Jason

This post has been edited 5 times, last edit by "JasonS" (Nov 5th 2011, 10:05pm)


Dani

Intermediate

  • "Dani" started this thread

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

3

Monday, November 7th 2011, 8:57am

Very nice JasonS!
Now we have solutions for most cases...

Posts: 10

Date of registration: May 9th 2014

  • Send private message

4

Tuesday, September 9th 2014, 11:46am

Another Option (Yes, I know it's an old thread)

This was the only hit I found when searching for how to do this and subsequently found a different way with out using BareBones.

Import java.awt.Desktop and java.net.uri

Then simply use the following line when you want to open a URL:

Desktop.getDesktop().browse(New URI("http://www.example.com"))

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

5

Wednesday, September 10th 2014, 2:25am

may i know whats the pros and cons of using this code instead:

Jabaco Source

1
2
3
4
5
6
Const quote = Chr(34)
   Dim url As String = "http://www.jabaco.org"
   Dim cmd As String = "cmd.exe /c start " & quote & "my window" & quote & " " & url
   
   Debug.Print cmd
   Shell(cmd)


it was given by A1880 here... http://www.jabaco.org/board/177-communicating-between-forms-and-with-the-internet-in-jabaco.html
.
.
Spare me, im new to Programming

JasonS

Trainee

  • "JasonS" is male

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

6

Wednesday, September 10th 2014, 7:47am

Hi Spysonic,

That would only work on windows, and I also do not think a browser applet is going to be very happy with trying to shell out commands, that would probably cause a security exception and not work in a browser app :)

The other examples given here (some) should work within a .jar file/browser applet. 8)

Regards,
Jason

Rate this thread
WoltLab Burning Board