Link to Website.
Author |
Message |
yumrum
|
Posted: Thu May 20, 2010 7:43 pm Post subject: Link to Website. |
|
|
I was wondering if there is a way to make my button when clicked open up a browser on a specific website? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Thu May 20, 2010 7:44 pm Post subject: RE:Link to Website. |
|
|
If you use Sys.Exec ( "url-goes-here" ) you should be able to open a website in the user's default browser. You'll have to put that in the callbacks you specify for the button. |
|
|
|
|
|
DtY
|
Posted: Thu May 20, 2010 8:29 pm Post subject: Re: RE:Link to Website. |
|
|
DemonWasp @ Thu May 20, 2010 7:44 pm wrote: If you use Sys.Exec ( "url-goes-here" ) you should be able to open a website in the user's default browser. You'll have to put that in the callbacks you specify for the button. Just want to point out, this will only work on windows.
On Mac OS X, the same thing can be accomplished with Sys.Exec("open url-goes-here"), on Linux or other Unices, you need to run a specific browser, firefox is pretty universal, but if you want to be more universal, you can have an option, or look in an environment variable. To open a webpage in firefox, you can do Sys.Exec("firefox url-goes-here").
---
The reason this only works on windows is that Sys.Exec() will execute a shell command, which on Windows can be any file, which also includes urls, which will open in the default program. This does not work anywhere else, but on Mac OS X, there is the `open` command, which will open a file in the default application (like just entering a filename in Windows). Linux and other Unices generally have no idea of "default applications", so you have to give an explicit command (in this case, firefox), followed by the file to open with it.
Most desktop environments on Linux (like KDE and Gnome) do keep track of default applications, so there should be some way to open with the default web browser if you can assume a certain desktop environment.
---
Non of this matters if you only need it to work on Windows. |
|
|
|
|
|
yumrum
|
Posted: Fri May 21, 2010 8:32 pm Post subject: RE:Link to Website. |
|
|
Fortunately i got windows so I'm all good. Thank you.
That stuff on the other operating systems is actually really cool. |
|
|
|
|
|
yumrum
|
Posted: Tue May 25, 2010 7:23 pm Post subject: RE:Link to Website. |
|
|
U trued Getting the Sys.Exec(Url) to work but i'm am getting an error that the variable Sys dosn't exsist. |
|
|
|
|
|
Tony
|
|
|
|
|
TheGuardian001
|
Posted: Wed May 26, 2010 12:02 pm Post subject: Re: Link to Website. |
|
|
I'm guessing nobody here has realised that this post actually isn't in the Turing section of the forums? |
|
|
|
|
|
Tony
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|