Четверг 20-го ноября 2008г.    08:07ч.
Главная arrow Блог arrow Wordpress: Travelog – exclude embedded maps in IE
Wordpress: Travelog – exclude embedded maps in IE Печать E-mail
Разработка сайтов
27.12.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!

Комментарии
Добавить новый RSS
Оставить комментарий
Имя:
Email:
 
Тема:
UBB-Код:
[b] [i] [u] [url] [quote] [code] [img] 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
Пожалуйста, введите проверочный код, который Вы видите на картинке.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
« Пред.   След. »
Вернуться

Навигация

Главная
Путешествия
Блог
Разработка сайтов
Галерея
Загрузки
Связь
Поиск
Карта сайта

Популярное






Забыли пароль?