Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition printer problem router slow software sound trojan usb video virus vista windows windows vista windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Image map in Firefox


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
03-Oct-2005, 03:56 PM #1
Image map in Firefox
Hi. I have an image map, but it won't work in Firefox. Any ideas?
I've validated it on the W3C
validator, but it looks fine.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,188 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
03-Oct-2005, 04:24 PM #2
Quote:
Originally Posted by DrP
Hi. I have an image map, but it won't work in Firefox. Any ideas?
I've validated it on the W3C
validator, but it looks fine.
If you use XHTML 1.0 Transitional, then you can use the "name" attribute.

Then the image maps will work.

In XHTML 1.0 Strict and XHTML 1.1, the "name" attribute is replaced with "id" and sadly Image maps don't currently work with "id"

<map name="map1">
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
03-Oct-2005, 04:32 PM #3
Yep, works fine now. Thanks for that namenotfound.
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
04-Oct-2005, 12:23 AM #4
Just some extra info.

XHTML 1.0 doctypes require an id attribute for the map element, but also allow the name attribute if it has the same value as the id attribute.

The usemap attribute for the img, input and object element is of type "URI"; meaning that when you do usemap="#somemap", the value is a resolved value of location.href + #somemap, which references an element in the document with a name or id of somemap. So if the page is http://somesite.com/test.html and you have usemap="#somemap", internally in the browser, the usemap value would be http://somesite.com/test.html#somemap .

With the XHTML 1.1 doctype, id is required for the map element, but the name attribute is not allowed. The usemap attribute for img, input and object is of type "idref"; meaning the value is just a reference to an id and when you do usemap="somemap", it just references an element with id="somemap". Because it's just an idref, # isn't allowed in the usemap attribute value.

As for browsers:

IE, Opera and Safari only support image maps the "uri" way regardless of doctype or mime type. Safari doesn't seem to support image maps for the input and object element at all. (at least 1.3).

Now Firefox goes by mime type. If you serve XHTML 1.0 or XHTML 1.1 as application/xhtml+xml, Firefox uses the idref way. If you serve XHTML 1.0 or XHTML 1.1 as text/html, Firefox uses the uri way. However, Firefox still plays nice and allows # when it's using the idref way.

(XHTML 1.1 is not to be served as text/html so you could say that Firefox is only in violation of xhtml 1.0. because the usemap type shouldn't change with the mime type. Firefox should follow the standard XHTML 1.0 doctypes regardless of the mime type. Serving as application/xhtml+xml means you can forget about IE)

If you serve XHTML 1.0 as text/html you really have no worries. If you serve it as application/xhtml+xml, you have to make sure both the name and id attributes are the same for the map element and use # so all application/xhtml+xml browsers are happy. Same thing goes for XHTML 1.1. Now at any time the validator complains (once you've done everything you are supposed to) you can always use a custom doctype or add attribute declarations to the doctype so the validator doesn't throw a fit. An example of this woud be for the XHTML 1.1 doctype, where you change the usemap type declaration to uri and add the name attribute to the map element.

As said above, Opera does't support XHTML 1.1 image maps, but there's a user javascript fix that makes them work while using fully compliant code with a non-modified XHTML 1.1 doctype served as application/xhtml.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
05-Oct-2005, 01:22 AM #5
Thanks for the info.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:50 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.