Image Map not working in Firefox! works fine in Chrome+Safari

Bryan Collins picture Bryan Collins · Apr 13, 2013 · Viewed 14.9k times · Source

Ive made a image map and its not working in firefox. It works fine in both Chrome and Safari.

This is the site bryanedwardcollins.com

Please help!

    <MAP NAME="menumap" >
<AREA 
HREF="contact.html" ALT="contact" 
SHAPE="POLY" COORDS="425,100, 572,89, 594,142, 488,150, 460,166, 423,100">
    <AREA
    HREF="insameit.html" ALT="insame i.t." 
    SHAPE="POLY" COORDS="382,239, 462,245, 461,343, 608,344, 610,395, 354,405, 354,341">
    <AREA
    HREF="floorpart.html" ALT="floor part" 
    SHAPE="POLY" COORDS="307,185, 429,185, 430,221, 379,222, 374,235, 283,224">
    <AREA
    HREF="iouse.html" ALT="I O Use" 
    SHAPE="POLY" COORDS="27,18, 231,16, 243,0, 382,0, 253,265, 69,252, 193,73, 27,73">
    <AREA
    HREF="worldpart.html" ALT="world part" 
    SHAPE="POLY" COORDS="25,303, 122,305, 122,448, 27,449">
    </MAP>

Answer

Paul Renton picture Paul Renton · Jul 10, 2013

I stumbled into this issue as well. It seems that Chrome will parse the img attribute usemap="mapName" without the # symbol. However, if you don't include the hash symbol '#', the map will not be associated with the image on FireFox and Internet Explorer.

Here is the correct way to do it:

<img src="images/header.jpg" id="hdr" name="hdr" usemap="#hdrMap" alt="alt string here" border="0">
    <map name="hdrMap" style="cursor:pointer;">
        <area shape="rect" coords="720,65,880,0" href="http://www.thisisthefirstlink.com" target="_blank" alt="first link alt">
        <area shape="rect" coords="882,65,1024,0" href="http://www.secondlink.com" target="_blank" alt="second link alt">
    </map>

Notice the usemap="#hrdMap" has a hash tag symbol and matches the name="hdrMap" attribute for the map tag. This can seem a little confusing because a lot of people associate the # symbol with referencing an id attribute.

Hope this helps