The underestimated object element

One of the more powerful elements in XHTML MP (actually a part of XHTML, but extremely powerful and flexible in our mobile world) is the element. Still, it is not used very often. So, I thought I would do some promotion!

The object element has been around from the start of XHTML MP, but historically devices have had poor support. However, this has changed. The support in Netfront is good, same goes for Webkit.

The object element is in theory used for embedding any kind of object into the web page for inline rendering. This includes images, video, audio (background music on the page, brings us back to the early 90’s 😉 ), Java apps, Flash, text etc. And, the most fascinating; it provides a nice fall-back mechanism by nesting -tags inside each other enabling the device to display the first content type it can handle. For example this code:

…will display an SVG image to phones who support that, and a GIF for those that don’t. So, what we have is a kind of a client-side device adaptation. I have made a demo of the code above here .

I have made some more demos to illustrate how you can use the object element:

  • How to create fallbacks (demo).

    The user-agent starts at the outer most object and keeps nesting deeper until it finds a type it understands.
  • Inline streaming video (demo).

    Should display the stream in an inline player in the page. Works well on Netfront >3.4. However, it requires that your mobile operator provides a single APN for both streaming and browsing, or that your phone can handle two open APNs simultaniously.
  • Audio player (demo).

    “So 90’s” you may think, but have a look at this site. Cool and useful!
  • Launching a midlet from a mobile internet page (demo).

    Will not display the midlet inline as a good old applet, but this is a smart way of distributing and controlling java apps.
  • Flash lite (demo)

    Fall backs to a GIF.
  • Here’s a way of listing all properties of the object.(demo)

    Requires javascript support in your browser. In theory you can manipulate most of these properties runtime. Many cool mobile ajax apps maybe…?

That’s the promotion 🙂
A list of the stuff I have been playing with. (Test it on your mobile)

A bit more background information:

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Market leading device intelligence for the web, app and MNO ecosystems
DeviceAtlas - Device Intelligence

Real-time identification of fraudulent and misrepresented traffic
DeviceAssure - Device Verification

A free tool for developers, designers and marketers to test website performance
mobiReady - Evaluate your websites’ mobile readiness

© 2024 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland