How real is the embedded web-page technique?

Jeanne A. E. DeVoto jeanne at runrev.com
Thu Oct 10 01:56:01 EDT 2002


At 6:40 PM -0700 10/9/2002, RGould8 at aol.com wrote:
>If I go into the messagebox and type:
>
> put URL "http://www.runrev.com/index.html" into temp
> put "temp = " & temp
>
> I get no results.

Hmmm. It ought to work. It does take a few seconds typically to fetch the
page. Do you get no result at all, or do you get "temp = " in the message
box with no HTML following it?


> When I do get this working, will I be able to have the user click on
>the hyperlinks displayed on the web-page that's displayed as HTML
>in that field?

Yes, but you will have to do a bit of extra scripting to enable it.

What Revolution does when it sees a hyperlink in HTML (an "a href" tag) is
make that text into a text group by setting its textStyle to "link". The
text group's linkText property is set to the link's URL. When you click a
text group, a linkClicked message is sent, with the linkText as its
parameter.

To make clicking on a link actually do something useful, you need to
install a linkClicked handler in your field script (or further along the
message path):

  on linkClicked theLink
    get URL theLink
    set the htmlText of me to it
  end linkClicked

This gets the contents of the URL referenced by the link, and sets the
htmlText of the field to that new URL. (You might also want to do something
different with this, such as go to the referenced page in a browser
instead, download it to disk, etc.)

(This also assumes the link reference contains an absolute URL
("http://www.example.com/file.html") rather than a relative URL
("../file.html") - if the page may have relative URLs, and of course most
do, a bit of extra scripting will be needed to generate the correct
absolute URL based on either the current page's URL, or the base URL in the
document <head>.)

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list