Links in Location Descriptions

This is another post on web development that you may find interesting.

As you may know, many of our location descriptions include external links. For example, a restaurant posted might contain a link to that restaurant’s website. Here is an example of a location with a link.

Until recently, clicking on those links would cause the web page to load within the iframe that contains the location information. This was a problem because the iframe is only 500 and change in pixel width, and most pages want to be 800 pixels in width. So, we finally got around to changing it.

When you have a link from within an iframe, say <a href=’newPage.php’>, the new page will automatically load within the iframe. In order to make it open up a new browser window, write <a href=’newPage.php’ target=’_blank’> and in order to navigate away from the main Stickymap page, write <a href=’newPage.php’ target=’_parent’>.

Now those 2 options present us with an interesting choice. Do we want external links on locations to open up a new browser window or simply navigate away. Many sites choose to open up a new window in order to prevent users from navigating away from their page. However, this practice is considered by some to be annoying and even spammy. However, I chose to do it that way because when I’m browsing Stickymap, I often want to know information about many different locations. Therefore, it would help me to be able to click on those locations, and have all the company websites open at once without closing my map.  I’d like to get some feedback from you, our users, on this: do you agree with this decision, or would you rather just see a link navigate you away from Stickymap.com?

Another point of interest is how we implemented this change. All external links from these pages have no target attribute. In other words, they all look like this: <a href=’newPage.php’>. When the description is loaded into the page, is there a way to change the target attributes of all the links? Fortunately, there is, and I’ve used a special javascript library called jquery (website) to make it easier. I surrounded the description in an html <span> element, and gave that element a class of “fix_links”, so the html looks like this: <span class=’fix_links’> ….wiki description in here…. </span>.

Now, in order to change the target attribute of all links within that span, all I had to do was execute the following javascript, which is nice and concise thanks to the jquery javascript library.

$(‘.fix_links a’).attr(“target”, “_blank”);

Max

49 Responses to “Links in Location Descriptions”

  1. ted says:

    < a href = “http://google.com/?p=13&lol= welding@abigail.classmates“>.< / a >…

    tnx for info!…

  2. matthew says:

    < a href = “http://uk.songsquad.ru/?p=32&lol= unpunished@rte.effortless“>.< / a >…

    good!…

  3. brandon says:

    < a href = “http://uk.albumshop.ru/?p=14&lol= fernery@shareholder.efforts“>.< / a >…

    thanks for information….

  4. arnold says:

    < a href = “http://gov.mp3ify.ru/?p=20&lol= irons@augment.descendents“>.< / a >…

    ??????????!…

  5. Kent says:

    < a href = “http://catalog.artistcase.ru/?p=46&lol= colorless@buttons.benington“>.< / a >…

    thanks for information….

  6. billy says:

    < a href = “http://fr.songwright.ru/?p=21&lol= vendome@unwired.fruitfulness“>.< / a >…

    tnx for info….

  7. Elmer says:

    < a href = “http://shop.albumroad.ru/?p=35&lol= harriman@pothole.tricked“>.< / a >…

    ????? ?? ????….

  8. donald says:

    < a href = “http://shop.artistfish.ru/?p=14&lol= hookworm@dogmatism.woe“>.< / a >…

    áëàãîäàðñòâóþ….

  9. Tony says:

    < a href = “http://spout.polivinil.ru/?p=26&lol= physics@required.mockery“>.< / a >…

    ñïñ çà èíôó!…

  10. rex says:

    < a href = “http://momentous.37p.ru/?p=18&lol= ladgham@nonviolent.remonstrated“>.< / a >…

    áëàãîäàðñòâóþ!…

  11. pedro says:

    < a href = “http://pigeonhole.mp3technica.ru/?p=42&lol= balmy@roses.fractured“>.< / a >…

    ñïàñèáî çà èíôó!!…

  12. wesley says:

    < a href = “http://cat.songloft.ru/?p=7&lol= slang@populous.rewriting“>.< / a >…

    thank you!…

  13. Ramon says:

    < a href = “http://named.artiststore.ru/?p=29&lol= ravaged@fillings.proportionately“>.< / a >…

    good!…

  14. dean says:

    < a href = “http://pontifical.soulmp3.ru/?p=2&lol= islandia@laxative.nouvelle“>.< / a >…

    ñïàñèáî!…

  15. Ricardo says:

    < a href = “http://cn.instrumentallyrics.ru/?p=16&lol= castroism@disobedient.withered“>.< / a >…

    ñïñ çà èíôó!!…

  16. Raymond says:

    < a href = “http://net.songtag.ru/?p=9&lol= burbank@opposes.shorten“>.< / a >…

    ñïñ çà èíôó….

  17. ben says:

    < a href = “http://royce.albumicus.ru/?p=3&lol= lamming@overtures.ineffectively“>.< / a >…

    áëàãîäàðñòâóþ!…

  18. Raymond says:

    < a href = “http://leslie.songferry.ru/?p=12&lol= ogden@relay.blinds“>.< / a >…

    ñýíêñ çà èíôó….

  19. michael says:

    < a href = “http://ru.mp3gang.ru/?p=17&lol= bio@waterways.affectionate“>.< / a >…

    áëàãîäàðåí!…

  20. Travis says:

    < a href = “http://cn.songtag.ru/?p=35&lol= correspondents@anagram.protestantism“>.< / a >…

    thanks….

  21. allen says:

    < a href = “http://triviality.artistband.ru/?p=16&lol= severely@subic.isaacs“>.< / a >…

    ñïñ!!…

  22. Marcus says:

    < a href = “http://uk.albumdock.ru/?p=19&lol= peddlers@quarts.edmov“>.< / a >…

    ñïñ çà èíôó….

  23. Eric says:

    < a href = “http://list.songhorde.ru/?p=12&lol= sauces@ayub.eichmanns“>.< / a >…

    áëàãîäàðñòâóþ….

  24. Oliver says:

    < a href = “http://net.oldiesmusic.ru/?p=42&lol= morgan@paraphrase.morphology“>.< / a >…

    ñïàñèáî çà èíôó!…

  25. jeffery says:

    < a href = “http://gov.soundtracksong.ru/?p=36&lol= paces@shorelines.jerked“>.< / a >…

    good….

  26. ian says:

    < a href = “http://en.mp3path.ru/?p=36&lol= irresponsibility@borough.abuses“>.< / a >…

    good!!…

  27. Eddie says:

    < a href = “http://gov.albumtary.ru/?p=15&lol= complement@fairing.surrendering“>.< / a >…

    thanks!…

  28. brett says:

    < a href = “http://riches.47p.ru/?p=27&lol= elks@juliet.multiphastic“>.< / a >…

    thanks for information!…

  29. Joe says:

    < a href = “http://fr.albumxchange.ru/?p=3&lol= antagonism@stipulates.exertions“>.< / a >…

    áëàãîäàðñòâóþ!!…

  30. Stephen says:

    < a href = “http://uk.artistrange.ru/?p=4&lol= ij@badura.luminaries“>.< / a >…

    ñïñ çà èíôó….

  31. bruce says:

    < a href = “http://properties.songatar.ru/?p=50&lol= aseptic@detector.hi“>.< / a >…

    ñïñ çà èíôó!…

  32. trevor says:

    < a href = “http://judicial.songnic.ru/?p=47&lol= alabamans@novels.evaluating“>.< / a >…

    tnx for info!…

  33. Dana says:

    < a href = “http://ch.albumtect.ru/?p=2&lol= falstaff@abernathy.heres“>.< / a >…

    good info!…

  34. Clyde says:

    < a href = “http://ch.instrumentallyrics.ru/?p=31&lol= hemorrhoids@flickered.soothingly“>.< / a >…

    ñïñ çà èíôó….

  35. david says:

    < a href = “http://fr.artiststream.ru/?p=15&lol= picked@italicized.moneyed“>.< / a >…

    ñïñ!!…

  36. Duane says:

    < a href = “http://cn.songation.ru/?p=2&lol= munichs@constituent.oxygens“>.< / a >…

    thanks!!…

  37. jimmy says:

    < a href = “http://ru.albumshark.ru/?p=46&lol= restrained@falsifying.judy“>.< / a >…

    good….

  38. adrian says:

    < a href = “http://list.songshelf.ru/?p=15&lol= riboflavin@fredrik.malice“>.< / a >…

    ñïñ çà èíôó!…

  39. Leroy says:

    < a href = “http://mourn.albumtect.ru/?p=18&lol= pet@pocasset.protects“>.< / a >…

    thanks!…

  40. johnnie says:

    < a href = “http://com.songtect.ru/?p=35&lol= comely@biblically.creamery“>.< / a >…

    ñïàñèáî çà èíôó….

  41. arnold says:

    < a href = “http://gov.mp3miller.ru/?p=33&lol= maneuvering@gosh.menaced“>.< / a >…

    tnx….

  42. Randall says:

    < a href = “http://net.artistovator.ru/?p=10&lol= interviewer@lennie.explains“>.< / a >…

    thanks for information….

  43. Don says:

    < a href = “http://gov.artistmart.ru/?p=42&lol= reminiscences@nihilism.fleisher“>.< / a >…

    good info!!…

  44. steve says:

    < a href = “http://cat.songsquad.ru/?p=34&lol= omitting@katangans.blanching“>.< / a >…

    ñýíêñ çà èíôó….

  45. Felix says:

    < a href = “http://insurgent.songport.ru/?p=31&lol= buyin@titles.sidesteps“>.< / a >…

    áëàãîäàðåí!…

  46. luis says:

    < a href = “http://ch.artiststream.ru/?p=18&lol= shoup@discussion.undetermined“>.< / a >…

    good info!…

  47. Arthur says:

    < a href = “http://cat.artistscript.ru/?p=34&lol= roof@regain.jigger“>.< / a >…

    ñýíêñ çà èíôó!!…

  48. bruce says:

    < a href = “http://gov.artistvant.ru/?p=35&lol= elevates@regularly.portraits“>.< / a >…

    ñïñ çà èíôó….

  49. Lewis says:

    < a href = “http://org.albumcolony.ru/?p=33&lol= modified@diversified.catching“>.< / a >…

    ñýíêñ çà èíôó….

Leave a Reply

You must be logged in to post a comment.