Jump to content

TITLE attribute on IMG tags being stripped?


Mesa Mike

Recommended Posts

Trying to get pop-up TITLE text on images on one of my cache pages to work, but seems the TITLE attribute is stripped by the server before sending it to the browser.

 

Most people misuse the ALT attribute to do the same thing, but the ALT attribute is the text that's supposed to pop up if the image doesn't load for some reason, not the text that's supposed to pop up when you hover your pointer over a loaded image.

 

Yes I know, Internet Explorer doesn't seem to care whether you use ALT or TITLE, but those of us using browsers that actually conform to the HTML specifications won't normally be able to see the ALT text. We need the server to pass TITLE attribute to the browser.

Link to comment

The title of a document is specified by the TITLE element. The TITLE element should occur in the HEAD of the document.

 

There may only be one title in any document. It should identify the content of the document in a fairly wide context.

 

The title is not part of the text of the document, but is a property of the whole document. It may not contain anchors, paragraph marks, or highlighting. The title may be used to identify the node in a history list, to label the window displaying the node, etc. It is not normally displayed in the text of a document itself. Contrast titles with headings . The title should ideally be less than 64 characters in length. That is, many applications will display document titles in window titles, menus, etc where there is only limited room. Whilst there is no limit on the length of a title (as it may be automatically generated from other data), information providers are warned that it may be truncated if long.

 

 

Since there is only one allowed yours wont work.

 

Here is an example. This is from a cache page.

 

<title>

GC1234 - A Unknown Cache in Kansas, United States called Mission: Impossible created by Ca$h_Cacher

</title>

 

Since its in use already and you can not access the Head section of the page its not going to work for you.

Edited by Michael
Link to comment

I'm not talking about the TITLE tag in an HTML document.

I'm talking about the TITLE attribute within a IMG tag.

 

For example: <IMG SRC="http://foo.com/bar.jpg" TITLE="foo">

 

Here, the TITLE attribute is supposed to cause the browser to pop up a "tooltip" with the specified text.

As I explained, this is usually done by misusing the ALT attribute,

like this: <IMG SRC="http://foo.com/bar.jpg" ALT="foo">

The reason this works for most people is that most people use Internet Explorer, which conflates ALT and TITLE, and will pop up the text with either.

 

This doesn't work with browsers that conform to the HTML specs, such as Firefox.

The ALT attribute is supposed to be for text that is displayed if the browser can't load the image for some reason. Firefox users won't see the ALT text when hovering over an image. This isn't really a Firefox problem, since this is exactly how the browser is supposed to behave according to the HTML specs.

 

It's not a big deal, just a minor annoyance.

Link to comment

Its possible that HTML-Tidy is stripping it out.

It is not HTML-tidy. The title attribute is valid HTML that Tidy accepts. In addition Tidy strips out bad HTML when the page is submitted. This is being striped out when the page is being rendered from the database. I believe this started with the April 16 release where Groundspeak tightened up on what HTML would be allowed in the cache page. The problem was first mentioned in that thread.

 

It seems unfortunate that a lot of people's pages were broken because this change went further than it needed for fixing some security problems. In this case there may be puzzles or hints that depend on the title attribute.

Link to comment

Trying to get pop-up TITLE text on images on one of my cache pages to work, but seems the TITLE attribute is stripped by the server before sending it to the browser.

 

Thanks for the info! We have a config file to explicitly allow certain tags and the "title" attribute wasn't set in there. I have made the change and it will show up in the next site update.

Link to comment

Jeremy,

 

Thanks for the response. Will the rel and title attributes also be allowed on <a> tags? That was brought up repeatedly in the "release notes" thread, but I haven't seen any acknowlegement of the problem from gc.com. Don't want to nag if it's on the schedule, but as I say I haven't seen any ack.

 

Edward

Link to comment

Is there any time frame for when that change will be deployed to the production servers?

 

Standard release schedule is once every two weeks but hotfixes can apply the change sooner. Last formal release was on Tuesday, May 13 and hotfixes were applied on Wednesday and Thursday.

Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...