TIP: Opening Web Pages

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

TIP: Opening Web Pages

Postby david » Mon Dec 29, 2003 8:33 pm

(1) You can open up a web page using "application.showURL()." A typical example would be:

application.showURL('http://www.mapquest.com');

(2) You can display a map of my address -- 8120 Woodmont Avenue, Bethesda, MD:

application.showURL('http://www.mapquest.com/maps/map.adp?country=US&address=8120%20Woodmont&city=Bethesda&state=MD&submit=Get+Map');

(3) You can use Servoy record information to build your string dynamically so that you can display a map for each record:

//build connection string
var connection_string =
'http://www.mapquest.com/maps/map.adp?' +
'country=' + escape(field_country) +
'&address=' + escape(field_address) +
'&city=' + escape(field_city) +
'&state=' + escape(field_state) +
'&submit=Get%20Map'

//send string to default browser
application.showURL(connection_string);

The TIP here is to use the javascript function "escape()" to ASCII encode the string before sending it to the browser. For example, instead of sending "&address=8120 Woodmont" (which would fail) this portion of the string would have the space encoded to send "&address=8120%20Woodmont".

- david
Last edited by david on Tue Dec 30, 2003 12:39 am, edited 1 time in total.
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Postby maarten » Mon Dec 29, 2003 11:13 pm

cool stuff 8)
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands


Return to How To

Who is online

Users browsing this forum: No registered users and 4 guests

cron