Google Maps for IE6 and IE7 in XHTML 1.0 Strict


/ Published in: JavaScript
Save to your folder(s)

XHTML 1.0 Strict deprecates the use of iframes in favor of objects. While this has gotten a lot of flack, iframes were never truly a part of HTML, just a proprietary element in Internet Explorer that eventually got universal support. Objects are a more appropriate way of including external content, but support is limited in IE6 and IE7.

In particular, Google Maps embedded as Objects do not render at all in IE6 or IE7, this JavaScript snippet will take a Google Map embedded as an Object and convert it into an iframe dynamically for IE6 and IE7.

See the URL for more information and usage instructions.

_**Note:** This script works by attaching to an object with an id of "map". If you have multiple maps on one page, or simply want to use a different id, change "map" in the snippet to the id of your choice._


Copy this code and paste it in your HTML
  1. <!--[if lte IE 7]><script type="text/javascript">(function(){var o=document.
  2. getElementById('map');var i=document.createElement('iframe');i.setAttribute
  3. ('src',o.getAttribute('data'));i.style.width=o.style.width;i.style.height=o.style.
  4. height;o.parentNode.replaceChild(i,o);})();</script><![endif]-->

URL: http://blog.poplabs.com/2009/08/28/embedding-google-maps-iframe-to-object-with-xhtml-strict/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.