This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

[closed] Problem Starting Firefox With OSM URL Containing Ampersand

0

I'm working on some software that does its calcs. and then starts up a new Firefox browser window passing the OSM URL and the relevant Lat. and Lon. parameters, e.g. https://www.openstreetmap.org/?lat=52.1917&lon=-1.7073&zoom=12

However nothing from the first ampersand onwards appears in the Firefox address bar, and Firefox just displays the last OSM map view viewed in Firefox, regardless of the actual Lat. in the address bar. Have tried executing the full command (i.e. that issued by my software) from the command prompt in the "DOS window", e.g... "C:\Program Files\Mozilla Firefox\firefox.exe" -new-tab https://www.openstreetmap.org/?lat=52.1917&lon=-1.7073&zoom=12 and the error messages I get are 'lon' is not recognized as an internal or external command, operable program or batch file. 'zoom' is not recognized as an internal or external command, operable program or batch file.

So it seems to me that WinXP is doing some parsing of the parameter string being passed to Firefox and only actually passing the "lat" parameter to Firefox.

I tried escaping the ampersands with %26 and the whole parameter string then gets through to Firefox but the OSM server (or Firefox?) seems not to recognise the escaped ampersands, thereby displaying the last map shown. I've tried with a semicolon as an alternative delimiter (which, I believe, is supposed to be a valid delimiter) and also the comma, but they just display the last map shown as described above.

Regular URLs without the ampersand, e.g. a tile URL (http://tile.openstreetmap.org/12/2028/1349.png), work fine.

It seems the required ampersand in the query parameter is tripping me up via WinXP! Any ideas on a resolution? Ta!

asked 25 Oct '12, 16:38

vagabond's gravatar image

vagabond
1954510
accept rate: 0%

closed 25 Oct '12, 16:57

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866

The question has been closed for the following reason “Question is off-topic or not relevant” by SomeoneElse 25 Oct ‘12, 16:57


One Answer:

1

Not that it's anything to do with OSM, but you need to put quotes around the address like you did around the program:

"C:\Program Files\Mozilla Firefox\firefox.exe" -new-tab "https://www.openstreetmap.org/?lat=52.1917&lon=-1.7073&zoom=12"

If you don't do that Windows will try and parse the command line rather than just passing it to Firefox.

answered 25 Oct '12, 16:56

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

Source code available on GitHub .