[OSM-dev] How to download the map data Programatically and make right-click menu support?

Stefan Breunig stefan at mathphys.fsk.uni-heidelberg.de
Tue Feb 24 01:57:22 GMT 2009

You can parse XML files using the browser's integrated XML parser, see
[1]. However, due to security reasons you can't do this across domains
– you'll have to save the XML file to your server either manually or
via server side processing (e.g. C++, PHP or whatever programming
language your server has to offer). [1] also notes this. Flash can
probably work cross-domain, but I'm not sure about that and I don't
know if it's even possible to transfer the data from Flash to HTML
DOM/JS, but if you don't have server side programming support it's
probably your only chance.

Context menu: You don't. Taking control way from the user is never a
good idea and that's the reason why all modern browsers don't allow
you to do such a thing. While there may be valid use cases it was
often abused to do annoying things like popping an alert box "right
click now allowed". Since no webpage uses context menus for these
reasons, discoverability would be pure luck. Better make a webpage
behave like a webpage – makes better user experience, too. My
suggestion would be to add a similar menu like the layer switcher is


[1] http://www.w3schools.com/Xml/xml_parser.asp

On Tue, Feb 24, 2009 at 02:34, xintao <xintaoliu at hotmail.com> wrote:
> Dear all,
> Hi, we know we can access the OSM data using this method:
> http://api.openstreetmap.org/api/0.5/trackpoints?bbox=0,51.5,0.25,51.75.
> My question is, if I want to use Javascript code to save this file
> Programatically in my web page, how can I do it?
> Second, when I make a web mashup, e.g.
> http://www.hig.se/~xioliu/openstreetmap.html, how can I add a rigth-click
> menu, rather than the right-click menu of the Brower?
> Any of your comments and advice are highly appreciated and anticipated. Many
> thanks in advance.
> Yours sincerely
> Xintao
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev

Please encrypt your mail:
FP: 2620 E737 FD50 60AB 86B6 1B9D 3BFD AFFB 5B15 6893

More information about the dev mailing list