Your Development & Design Resource

MapQuest Direction Plugin

I was asked by a client the other day if I could include a simple function in the "Directions" section of their website - a link to MapQuest with their company address preset as the destination address.

I was able to build upon that request and come up with something that, while very simple, it's the method that I used to get this done that I thought I would share, as well as the since I've already invented the wheel code in case you find your applications needing such a function!

That being said, here's what I did...

First and foremost, I went to MapQuest to see exactly how they submit their information - that is, what happens after you type in your from and to addresses?

Luckily for me, this was the (well, one of the...) easiest parts, as MapQuest passes the address information through the URL. To find this out, I simply passed unqiue dummy data to each field (see below) and read the URL that was returned when I pressed "Get Directions".

Mapquest Page

From this, I could see just what the URL was passing to the MapQuest directions engine, which I could use to create a plugin for any website

The URL that was returned looked like this when I copy/pasted it into Notepad:

img src="pages/mapquestdirectionsplugin.html/$file/mapquest_URLinNotepad.gif" alt="URL in Notepad">

Now, it was simply a matter of providing the user a entry form to populate the needed information (ie, starting address, city, state, etc.) that would be passed to the MapQuest directions engine via the URL, and then the function that did it! I did the first part of this with some very quick and basic HTML.

HTML Code in Notepad

The Javascript function was simply a call to "launch" the URL grabbing the field values from my simple HTML form: (replace all "_" in the script below)

function runMQdir() {
var sURL = "
var target ="_blank";, target)

Now that I had my little snippet of HTML and my javascript function, I could add CSS for styling and provide a small afterthought of an enhancement - but one that can really bring the customer right to your front door!


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.

More from is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.