Welcome to WebmasterWorld Guest from 54.197.72.5

Forum Moderators: incrediBILL

Message Too Old, No Replies

Media Attribute in Link Tags

     
4:45 am on Sep 8, 2013 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 22, 2004
posts: 113
votes: 0


<link rel="alternate" media="handheld" href="http://m.example.com" />


I've seen this, and variations of this, used a lot to direct (I assume) search engines to the appropriate versions of a web page. But I have never been able to find an authoritative list of media types anywhere. Does one exist? Are there media types for tables for example? Not quite mobile, not quite standard web? Are there media types for ancient/obsolete browsers? It's a hard thing to search for, because all of the words involved are so generic. "link alternate media tag"
7:23 am on Sept 8, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13250
votes: 358


http://www.w3.org/TR/CSS2/media.html#media-types

Don't try to get fancy.
10:35 pm on Sept 8, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 23, 2005
posts:742
votes: 0


Actually, this is the one he wants: [w3.org...]
10:30 am on Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


Not sure about the HTML4 reference -- The recognized/accepted media types are actually defined by CSS.

Here's the most recent list of types, which happens to be the same as the one Lucy24 posted [CSS3 -- the one I linked -- is not yet the recommendation]. Notice the lists in CSS2.1 and CSS3 are not exactly the same as the list linked from the HTML4* docs:

http://www.w3.org/TR/css3-syntax/#media-types

* The HTML4 documentation links to a list of types with Aural and without Speech or Embossed -- http://www.w3.org/TR/html401/types.html#type-media-descriptors -- but Aural has been deprecated and Speech + Embossed have been added since at least CSS2.1 (June 2011)
2:29 pm on Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 23, 2005
posts:742
votes: 0


The recognized/accepted media types are actually defined by CSS.

That's not what he's using. He's using a HTML attribute for media.
4:53 pm on Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


The types of media allowed in HTML attributes are still now [as of HTML5] defined by the CSS specs, not HTML -- If you can find a list like you linked in the HTML5 docs, please post a link. My guess is if you look for very long all you'll end up with is a headache after being constantly referred to the CSS docs, but it's possible there's something I missed.
6:04 pm on Sept 19, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts: 4988
votes: 12


There is a list defined within HTML 4.01.
[w3.org...]


Future versions of HTML may introduce new values and may allow parameterized values.
6:20 pm on Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


There is a list defined within HTML 4.01.

Future versions of HTML may introduce new values and may allow parameterized values.

They already have and it's been switched to CSS. That's why I posted.

The HTML4 list -- All emphasis below added:

screen
tty
tv
projection
handheld
print
braille
aural
all

http://www.w3.org/TR/html401/types.html#type-media-descriptors

Note: CSS2 had a similar media type called 'aural' for this purpose. See the appendix on aural style sheets for details.

[The preceding is in reference to the addition of "screen" and deprecation of "aural" in CSS 2.1 -- Currently the CSS recommendation.]

http://www.w3.org/TR/CSS2/media.html#media-types

We expect that in a future level of CSS there will be new properties and values defined for speech output. Therefore CSS 2.1 reserves the 'speech' media type (see chapter 7, "Media types"), but does not yet define which properties do or do not apply to it.

The properties in this appendix apply to a media type 'aural', that was introduced in CSS2. The type 'aural' is now deprecated.

[w3.org...]
7:01 pm on Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


A couple more references -- Again emphasis added:
The media attribute says which media the resource applies to. The value must be a valid media query. [valid media query is linked to http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#valid-media-query]

Source: http://www.w3.org/html/wg/drafts/html/master/document-metadata.html#attr-link-media

A string is a valid media query if it matches the media_query_list production of the Media Queries specification. [MQ] [MQ is linked to http://www.w3.org/html/wg/drafts/html/master/references.html#refsMQ -- which links to -- http://www.w3.org/TR/css3-mediaqueries/

Source: http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#valid-media-query

The ‘print’ and ‘screen’ media types are defined in HTML4. The complete list of media types in HTML4 is: ‘aural’, ‘braille’, ‘handheld’, ‘print’, ‘projection’, ‘screen’, ‘tty’, ‘tv’. CSS2 defines the same list, deprecates ‘aural’ and adds ‘embossed’ and ‘speech’. Also, ‘all’ is used to indicate that the style sheet applies to all media types.

Source: http://www.w3.org/TR/css3-mediaqueries/