This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

XMLNS attribute

Property of dom/Elementdom/Element


var result = element.XMLNS attribute;
element.XMLNS attribute = value;


This example shows how to declare a namespace when one of the default behaviors in Internet Explorer, clientCaps, is used as a custom tag in an HTML document. Note that the declared namespace (in this case, MSIE) is a prefix to the name of the default behavior in the custom tag. This example also shows how the clientCaps behavior can be used to install the Internet Explorer Data Binding component, if the component does not already exist in the user’s system.

@media all {
   MSIE\:clientCaps {behavior:url(#default#clientcaps);}
function window.onload()
   var bDataBindingAvailable  = false;
   var sDataBindingVersion = '';
   var sDataBindingID =
   bDataBindingAvailable =
   // if data binding is unavailable, install it
   if (!bDataBindingAvailable)
      oClientCaps.addComponentRequest (sDataBindingID,
      bDataBindingAvailable = oClientCaps.doComponentRequest();
   <MSIE:CLIENTCAPS ID="oClientCaps" />

View live example



You can declare multiple namespaces on the html tag, as shown in the following syntax.

<HTML XMLNS:Prefix1 XMLNS:Prefix2="">

The syntax for XMLNS is based on the W3C XML Namespace Spec. Although the World Wide Web Consortium (W3C) document allows you to declare namespaces on all tags, Microsoft Internet Explorer 5 supports namespace declaration only on the html tag.

See also

Related pages

  • html