URL link -- newbie time

Devin Asay devin_asay at byu.edu
Tue Feb 21 17:13:05 EST 2006


On Feb 21, 2006, at 2:44 PM, Timothy Miller wrote:

> Oh dear, this isn't supposed to be difficult. Maybe I'll get used  
> to the new documentation format. So far, it seems to have evolved  
> from "terse" to "overwhelming."
>
> All I want to do is put a clickable link in a field that will open  
> a web browser and navigate to the URL specified in the link.
>
> I.e., I might like to enter a link like http:// 
> www.nigerianmillions.com in a field. There might be text in the  
> field, before and after the link. If I click on the link, I want my  
> web browser to open and go to that web page.

Let's say fld "bunchamoney" contains the text "You can get millions  
by going to this web site." and you want to make the word "millions"  
clickable. Make the word "hot" and associate a string of text with it  
like this:

	set the textStyle of word 4 of fld "bunchamoney" to link
	set the linkText of word 4 of fld "bunchamoney" to "http:// 
www.nigerianmillions.com"

Now lock the field and write a linkClicked handler in its script. The  
linkClicked message returns the linkText of the linked text you  
clicked on so you have to provide a variable to hold the linkText  
contents:

   on linkClicked linkTextOfTheWordIClickedOn -- (or any variable  
name you want)
     if linkTextOfTheWordIClickedOn contains "http://" then
       revGoUrl linkTextOfTheWordIClickedOn
     end if
   end linkClicked

The revGoURL command opens the url in the browser that is set as the  
default browser for your system.
>
> I can't quite figure out how. It will be obvious *after* someone  
> tells me. It never seems obvious *before* someone tells me.

After a few times of having it become obvious *after* someone tells  
you, you'll start to get a feel for what "obvious" is in the Rev  
context. :-)
>
> I have several web browsers installed on my machine. Can I specify  
> a browser with the link? Like, "Use any browser that happens to be  
> open." or "If no browser is open, use Safari"? Otherwise, just "Use  
> Safari; launch it first if necessary"?

HTH

Devin


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list