Saturday May 10th 2008    1:59 am
Main page arrow Blog arrow Wordpress: Travelog – exclude embedded maps in IE
Wordpress: Travelog – exclude embedded maps in IE | Print |  E-mail
Web design
12 / 27 / 2006

I am using in my Wordpress blog the fabulous plugin Travelog . Since I use my own template for Wordpress it occured to me that Internet Explorer wasn’t able to load any pages with embedded maps, showing following message:

Internet Explorer cannot open the Internet site http://site.net
Operation aborted

The problem is that the blog itself is situated in a CSS container of my own template. As the embedded Google map’s Javascript starts processing before the container is closed, Internet explorer aborts loading the whole page.

After having tried out all these tips and reading all through the Google Groups on API , I finally got fed up of it and wrote a workaround for excluding the maps in IE. I made following change in travelog.php, beginning on line 917:

        // Output HTML Code
        $htmlCode = '
            <script type="text/javascript">
ie=typeof document.all==\'object\'&&!window.opera;
if(!ie){
var str=\'<p><script src="http://maps.google.com/maps?file=api&v=2&key='.get_option('travelog_googlemaps_key').'" type="text/javascript"><\/script>\'+
\'<script type="text/javascript" src="'.get_settings('siteurl').'/wp-content/plugins/travelog/mapfunction.js"><\/script>\'+
\'<script type="text/javascript">var XMLAddress = "'.get_settings('siteurl').'/wp-content/plugins/travelog/travelog_xml.php";<\/script>\'+
\'<div id="map'.$travelogNumMaps.'" style="width:'.$map_params['width'].'px;height:'.$map_params['height'].'px;margin:0 auto;padding:0;border: 1px solid #999;"><\/div>\'+
\'<script type="text/javascript">initializeMap(\\\''.$travelogNumMaps.'\\\', \\\'map'.$travelogNumMaps.'\\\', null, '.Travelog::map_type($map_params['map_type'],"map").', \\\''.$map_params['controls'].'\\\', \\\''.$map_params['show_controls'].'\\\',\\\''.$map_params['scale'].'\\\');';

        if($map_params['ids'] != '') $htmlCode .= "maps[$travelogNumMaps].mapLocations('".$map_params['ids']."');";
        if($map_params['trips'] != '') $htmlCode .= "maps[$travelogNumMaps].mapTrips(\\'".$map_params['trips']."\\');";

        $htmlCode .= '<\/script><\/p>\';
document.write(str);
document.close();
}
</script>
';

With these changes embedded maps will appear in any browser except of Internet Explorer (tested with Firefox, Opera, IE6, IE7).

Download the file here: travelog.php.zip

Unpack the file and overwite with it the existing travelog.php in the Wordpress plugin folder. Be sure you are using Travelog version 2.5!




Be first to comment this article
RSS comments

Write Comment
Name:
E-mail
Homepage
Title:
BBCode:Web AddressEmail AddressLoad Image from WebBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:

Code:* Code
I wish to be contacted by email regarding additional comments

 
< Prev   Next >
[ Back ]

Navigation

Main page
Seeking job in Copenhagen
Blog
Web design
Documents
Gallery
Downloads
Contact
Search
Sitemap
Administrator

New articles

Popular

Syndication