The Problem of Bloody IE from Microsoft

Gurpreet Singh Randhawa
Gurpreet Singh Randhawa used Ask the Experts™
I have a websit which loads google maps information from database using simple javascript technique..

So keeping that my website google mps work in ll brosers xcept the bloody Microsoft. The markers just do not show on my website..

I found documentElement Object undefined error in IE 7, 8.

So i have the following gmap code which uses documentElement, due to which i think javascript is breaking up and it is not loading the markers.

i have the following code as:

<script type="text/javascript">

    if (GBrowserIsCompatible()) {
      // this variable will collect the html which will eventualkly be placed in the side_bar
      var side_bar_html = "";
      // arrays to hold copies of the markers used by the side_bar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var i = 0;

      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        // add a line to the side_bar html
        side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
        return marker;

      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        GEvent.trigger(gmarkers[i], "click");

      // create the map
      var map = new GMap2(document.getElementById("map_1"),{size:new GSize(580,370)});
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(31.634675549541356,74.8773193359375),8);

      // Read the data from xml File
      var request = GXmlHttp.create();"GET", "xml/#dirName#/#dirName##ext#", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = GXml.parse(request.responseText);
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("latitude"));
            var lng = parseFloat(markers[i].getAttribute("longitude"));
            var point = new GLatLng(lat,lng);
            var html = markers[i].getAttribute("pagename");
			var label = markers[i].getAttribute("address");
            // create the marker
			html = html + '<br>' + label;
            var marker = createMarker(point,label,html);
          // put the assembled side_bar_html contents into the side_bar div
          document.getElementById("side_bar").innerHTML = side_bar_html;

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

If you are developing in, you are welcome to use our GMap.NET, an open source control for implementing google maps without the need for writing any code
i am using Coldfusion My Friend!

way to far away from .net
Top Expert 2014

Hello myselfrandhawa,

Your null object : xmlDoc.documentElement
Line 51, could you insert an : alert("xmlDoc.documentElement is : " + xmlDoc.documentElement);

How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Top Expert 2014

Could you post <head> part of your page ?
Here it is:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfinclude template="meta.cfm">
<cfparam name="loginusername" default="">
<style type="text/css">
body {
      background-image: url(images/bg.jpg);
      background-repeat: repeat-x;
      background-color: #dddddd;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
<script language="javascript1.2" src="corecontrol/js/jsfile.js" type="text/javascript"></script>
<script language="javascript1.2" src="script/ajax.js" type="text/javascript"></script>
<link href="style/default.css" rel="stylesheet" type="text/css">
<script language="javascript1.2" src="script/suckertree.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/suckertree.css" type="text/css">
Top Expert 2014

Replace :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

By :
<meta http-equiv="Content-Type" content="text/xml; charset=ISO-8859-1" />
still that did not solved the issue!
any update Experts
Ok leekim971:

alert("xmlDoc.documentElement is : " + xmlDoc.documentElement);

I ran the alert stuff u gave me in in Mozilla it showed:

xmlDoc.documentElement is : [object Element]

while markers show in Mozilla

and the same in ran in IE 8, it showed

xmlDoc.documentElement is : null

The Markers do not show up in IE 8
Top Expert 2014

I think already do that , place an alert between

        if (request.readyState == 4) {
          var xmlDoc = GXml.parse(request.responseText);

So :

        if (request.readyState == 4) {
          alert( "request.responseText is : " + request.responseText );
          var xmlDoc = GXml.parse(request.responseText);
          alert( "xmlDoc is : " + xmlDoc ); // and after too

Ok I did and got some responses in IE 8, 7 as:

Top Expert 2014

OK so we know now we have a problem with GXml.parse :

Could you replace :
 alert( "request.responseText is : " + request.responseText );
By :
document.getElementById("myTextArea").value = request.responseText;

And add in your page a textarea to be able to post the xml file here, we'll check it's a valid file :

<textarea name="myTextArea" cols="64" rows="16" id="myTextArea"></textarea>

Open in new window

here is the pasted stuff:

Top Expert 2014

Try again ;-))
pasted Stuff:

<?xml version="1.0" encoding="UTF-8"?>
<markering><marker address="Zapak Gaming Station,Ranjit Avenue, Amritsar" latitude="31.6493080829" longitude="74.8623847961" pagename="Zapak Gaming Station"/><marker address="Opposite church, Court Road, Amritsar - 143001" latitude="31.6370824946" longitude="74.8681676388" pagename="Raj Continental"/><marker address="G.T Road, Amritsar - 143001 " latitude="31.5970149654" longitude="74.9501788616" pagename="Teg Resorts"/><marker address="Hotel Ritz Plaza, 45, The Mall, Amritsar" latitude="31.6413722" longitude="74.8695361" pagename="Hotel Ritz Plaza"/><marker address="Watz Kukin, Green Avenue, Amritsar" latitude="31.6481774" longitude="74.8667950" pagename="Watz Kukin"/><marker address="AlphaOne Mall, G.T Road, Amritsar - 143001" latitude="31.6188895615" longitude="74.9078428745" pagename="Alpha One Mall"/><marker address="Habibs, 17/10 Kennedy Avenue, Amritsar" latitude="31.6308900" longitude="74.8715520" pagename="Habibs"/><marker address="Habibs, Kennedy Avenue Market, Amritsar" latitude="31.6422752551" longitude="31.6422752551" pagename="Habibs"/><marker address="Albert Road Amritsar - 143001" latitude="31.6393249624" longitude="74.8664885759" pagename="Mohan International Hotel"/><marker address="Amritsar, Punjab, India" latitude="31.63089" longitude="74.871552" pagename="Ritu Wears"/><marker address="Hotel Grand Legacy, Gt Road, Amritsar" latitude="31.6298249321" longitude="74.8141264915" pagename="Hotel Grand Legacy"/><marker address="8-24/25,Lawrence Road, Amritsar" latitude="31.645626" longitude="74.877205" pagename="Cafe Coffee Day"/><marker address="Shop no-31 Ranjeet Avenue, Amritsar" latitude="31.651266" longitude="74.863976" pagename="Cafe Coffee Day"/><marker address="University Road, SCF - 50 Kot Khalsa Urban,Opp Kab" latitude="31.630674" longitude="74.827202" pagename="Cafe Coffee Day"/><marker address="Pizza Point, No. 5, Opp. Golden Temple,Amritsar" latitude="31.622530" longitude="74.879715" pagename="Cafe Coffee Day"/><marker address="Puma Store, Plot #35/13 Harmanz building, Mall roa" latitude="31.6420240728" longitude="74.8711717129" pagename="Puma"/><marker address="Levi's Store, Mall Road, Amritsar -143001" latitude="31.6413116249" longitude="74.8732477427" pagename="Levi's"/><marker address="Lawrence road, Amritsar, Punjab- 143001" latitude="31.6461068422" longitude="74.8779094219" pagename="Kanha Sweets"/><marker address="Ranjit Avenue,Amritsar - 143001" latitude="31.6534133644" longitude="74.8636454344" pagename="MK Hotel"/><marker address="45 District Shopping Complex B-Block, Ranjit Avenu" latitude="31.6511438375" longitude="74.8621675372" pagename="Best Western Merrion"/><marker address="Hotel Sham regency Amritsar" latitude="31.63089" longitude="74.871552" pagename="Hotel Sham Regency"/><marker address="Lawrence Road, Near Bijli Pehalwan Mandir, Amritsa" latitude="31.6453441908" longitude="74.8771610856" pagename="Color Lounge"/><marker address="Queens road, Amritsar - 143001" latitude="31.6351688185" longitude="74.8735642433" pagename="Country Inn &amp; Suites"/><marker address="Pr Residency , 101, District Shopping Centre, Ranj" latitude="31.6514713" longitude="74.8594853" pagename="Hotel P.R Residency"/><marker address="Pr Residency , 101, District Shopping Centre, Ranj" latitude="31.6575458618" longitude="74.8618268967" pagename="Hotel P.R Residency"/><marker address="SCO 122, District Shopping Centre, Ranjit Avenue, " latitude="31.6557741617" longitude="74.862588644" pagename="Gopalsons"/><marker address="Shop No. 24, District Shopping Complex, Ranjit Ave" latitude="31.6509109452" longitude="74.8633369803" pagename="Book Cafe"/><marker address="Vlcc, District Shopping Complex, Ranjit Avenue, Am" latitude="31.6514713" longitude="74.8594853" pagename="VLCC"/><marker address="Vlcc, District Shopping Complex, Ranjit Avenue, Am" latitude="31.6484130253" longitude="74.8620629311" pagename="VLCC"/><marker address="Raja Sansi Road , Near Border , Amritsar - 143001" latitude="31.6163496675" longitude="74.6860671043" pagename="Rainbow Resorts"/><marker address="Hotel Ritz Plaza 45, The Mall, Amritsar - 143001" latitude="31.6414098151" longitude="74.8698198795" pagename="Cafe 24"/><marker address="Reebok Store, 3-a Lawrence Road ,Amritsar -143001&#xa;" latitude="31.6435265893" longitude="74.8764932156" pagename="Reebok"/><marker address="Reebok Store, Shop No-4 &amp; 5,Opposite Khalsa Colleg" latitude="31.6319351188" longitude="74.8375582695" pagename="Reebok"/><marker address="Reebok Store, Ranjeet avenue, Amritsar -143001" latitude="31.6574271407" longitude="74.860625267" pagename="Reebok"/><marker address="Woodland Shopping Mall, Mall road, Amritsar" latitude="31.6428050" longitude="74.8638064" pagename="Woodland"/><marker address="Woodland Shopping Mall, Mall Road, Amritsar" latitude="31.6405946044" longitude="74.878950119" pagename="Woodland"/><marker address="Woodland, Cloud nine, Mall Road, Amritsar" latitude="31.6405946044" longitude="74.878950119" pagename="Woodland"/><marker address="Woodland, Lawrence road, Amritsar" latitude="31.6446317683" longitude="74.8768419027" pagename="Woodland"/><marker address="SCF 1 C-Block, Ranjit Avenue, Amritsar -143001" latitude="31.6561714273" longitude="74.8646378517" pagename="Eating Out"/><marker address="Queens road, Amritsar" latitude="31.6355410521" longitude="74.8758521676" pagename="Crystal Restaurant"/><marker address="Bansal Sweets, Lawrence road, Amritsar-143001" latitude="31.6468466537" longitude="74.8783922195" pagename="Bansal Sweets"/><marker address="Guru Nanak Dev University(Front gate),G.T road, Am" latitude="31.6314783725" longitude="74.8262286186" pagename="Guru Nanak Dev University"/><marker address="Guru Nanak Dev University(Back gate)  , Amritsar -" latitude="31.6436270607" longitude="74.8288679123" pagename="Guru Nanak Dev University"/><marker address="Central Mall, 32 The Mall Amritsar - 143001" latitude="31.6420788763" longitude="74.8693531752" pagename="Khurana Jewellery House"/><marker address="Celebration Mall, Bharat Nagar, Amritsar, Punjab, " latitude="31.639261" longitude="74.8906231" pagename="Celebration Mall"/><marker address="Nehru Complex , Lawrence Road Amritsar -143001" latitude="31.6424259641" longitude="74.8764288425" pagename="Surjit Chicken House"/><marker address="Near Pink Avenure (Madan Hospital) Majitha road Am" latitude="31.6423095071" longitude="74.884057045" pagename="Beera Chicken"/><marker address="SCO-24, District Shopping Centre, Ranjit Avenue, A" latitude="31.6508515805" longitude="74.8634067178" pagename="Bakes &amp; Beans"/><marker address="Cafe Coffee Day, Ranjit Avenue, Amritsar, Punjab, " latitude="31.6512671" longitude="74.8639727" pagename="Astoria Food Pavilion"/><marker address="Caf¿ Coffe Day G.N.D. U Amritsar" latitude="31.63089" longitude="74.871552" pagename="Astoria Food Pavilion"/><marker address="Astoria Food Pavilion Amritsar" latitude="31.6308900" longitude="74.8715520" pagename="Astoria Food Pavilion"/><marker address="1. 9, Madan mohan malviya road  2.Mall Road, Amrit" latitude="31.6375963031" longitude="74.8754712939" pagename="No Exit"/><marker address="Mall Road, Amritsar - 143001 " latitude="31.6412568209" longitude="74.8735964298" pagename="No Exit"/><marker address=" Ranjit Avenue  B-Block, Amritsar- 143001" latitude="31.6509520439" longitude="74.8626476526" pagename="Baskin Robbins"/><marker address="Hotel Royal Castle, 309, Albert Road, Amritsar" latitude="31.6374433" longitude="74.8644125" pagename="Hotel Royal Castle"/><marker address="Hotel Royal Castle, 309, Albert Road, Amritsar" latitude="31.6383293316" longitude="74.8663330078" pagename="Hotel Royal Castle"/><marker address="Hotel Grand, Opp Railway Station, Queens Road, Amr" latitude="31.6353951" longitude="74.8733679" pagename="Hotel Grand"/><marker address="Hotel Grand, Opp Railway Station, Queens Road, Amr" latitude="31.6345750685" longitude="74.8684680462" pagename="Hotel Grand"/><marker address="Hotel Grand, Opp Railway Station, Queens Road, Amr" latitude="31.6346618476" longitude="74.868875742" pagename="Hotel Grand"/><marker address="Balle Bowl , Sco 50 -51 District Shopping Centre, " latitude="31.6517968459" longitude="74.861934185" pagename="Dominos Pizza"/><marker address="Ground Floor, Shop No.7, Plot No.5-B , Circle No.1" latitude="31.6436772963" longitude="74.8766112328" pagename="Dominos Pizza"/><marker address="Ground Flour, Building No. B-II-36-S-1410-11 , Cho" latitude="31.6225165562" longitude="74.8796796799" pagename="Dominos Pizza"/><marker address="SCO - 111, Distt. Shopping Centre,&#xa;Near Regional P" latitude="31.6564979144" longitude="74.8619583249" pagename="Alstonia"/><marker address="Adjoining AlphaOne City Centre, M.B.M Farms, G.T r" latitude="31.6183048439" longitude="74.9085831642" pagename="Ista Hotel"/><marker address="Hotel Shiraz Regency, Queens Road, Amritsar" latitude="31.6353951" longitude="74.8733679" pagename="Hotel Shiraz Regency"/><marker address="Hotel Shiraz Regency, Queens Road, Amritsar" latitude="31.6354063174" longitude="74.8727273941" pagename="Hotel Shiraz Regency"/><marker address="Durgiana Temple, Amritsar -143001" latitude="31.6277832123" longitude="74.8680871725" pagename="Durgiana Temple"/><marker address="Golden Temple, Amritsar" latitude="31.6207715965" longitude="74.8773515224" pagename="Golden Temple"/><marker address="Shop No.2 &amp; 3, Upper Ground Floor, 35/13, Aventura" latitude="31.6420263563" longitude="74.8710912466" pagename="Spykar"/><marker address="Jallianwala Bagh,Near Golden Temple, Amritsar -143" latitude="31.6215595732" longitude="74.8796474934" pagename="Jallianwala Bagh"/><marker address="Wagah Border, Amritsar -143001 , Punjab" latitude="31.6048051" longitude="74.5739508" pagename="Wagah Border"/><marker address="D.A.V Public School, Lawrence road, Amritsar -1430" latitude="31.6443623251" longitude="74.8763591051" pagename="D.A.V Public School"/><marker address="Hotel Ritz Plaza 45, The Mall, Amritsar - 143001" latitude="31.6417683229" longitude="74.86995399" pagename="Ranjit's Restaurant"/><marker address="S.C.O. 22, District Shopping Complex, Ranjit Avenu" latitude="31.6507876491" longitude="74.8632109165" pagename="Groove In"/><marker address="361, The Mall Amritsar - 143001" latitude="31.641115244" longitude="74.8773890734" pagename="M.C International"/><marker address="Ranjeet Avenue, Near bypass road, Amritsar - 14300" latitude="31.6655957129" longitude="74.8672288656" pagename="WOW"/><marker address="Yo China, Ranjit Avenue,Next To Astoria, Amritsar" latitude="31.6308900" longitude="74.8715520" pagename="Yo! China"/><marker address="Yo China, Ranjit Avenue,Next To Astoria, Amritsar" latitude="31.6492532837" longitude="74.8621487617" pagename="Yo! China"/><marker address="SCO-88, District Shopping Centre, Ranjit Avenue, B" latitude="31.6571212048" longitude="74.8598796129" pagename="Smokin' Joes"/><marker address="Ebony Mall,The Mall , Amritsar " latitude="31.6422843889" longitude="74.8693263531" pagename="Ebony Mall"/><marker address="New Lawrence road,opp. BBK DAV College, Amritsar -" latitude="31.6450153811" longitude="74.8791700602" pagename="O2"/><marker address="1.Shop No 113 Ground Floor , Ranjit Avenue, Amrits" latitude="31.6559202825" longitude="74.8625564575" pagename="Barista Lavazza Espresso Bar"/><marker address="Barista, Rajasansi road, Amritsar-143001" latitude="31.7063821604" longitude="74.8167550564" pagename="Barista Lavazza Espresso Bar"/><marker address="New Lawrence road,opp. BBK DAV College, Amritsar -" latitude="31.6449240449" longitude="74.8791271448" pagename="Formos"/><marker address="Tummy Full Opp Mk Hotel, Amritsar" latitude="31.6308900" longitude="74.8715520" pagename="Tummy Full"/><marker address="Tummy Full Opp Mk Hotel, Amritsar" latitude="31.6533540013" longitude="74.8640370369" pagename="Tummy Full"/><marker address="1-Pink Avenue, Majitha Road Amritsar Punjab-143001" latitude="31.6435676913" longitude="74.8844647408" pagename="Madaan Hospital"/><marker address="Eminent Mall , 10 Kennedy Avenue the Mall Amritsar" latitude="31.6425287201" longitude="74.864474237" pagename="Malli Ram Jewellers"/><marker address="Race course road, Amritsar - 143001" latitude="31.6518744759" longitude="74.882222414" pagename="Blue Bakers"/><marker address="9, Mall road,Amritsar, Punjab 143001" latitude="31.6414532015" longitude="74.87447083" pagename="United Colors Of Benetton"/><marker address="Cee Tee mall, 32-A Mall road, The mall road, Amrit" latitude="31.6421154119" longitude="74.869594574" pagename="Talwalkars"/><marker address="Celebration Mall, GF-20,GF-21,Batala road, Amritsa" latitude="31.6393614991" longitude="74.8903870583" pagename="McDonald's"/><marker address="Shop No 6, Ansal Highway Plaza, At Village Khajurl" latitude="31.2776247415" longitude="75.6756144762" pagename="Barista"/><marker address="Dist Shopping Centre,Ranjit Avenue, Amritsar - 143" latitude="31.6512077686" longitude="74.8641228676" pagename="Subway"/><marker address="SCO 31, KK Towers, Shopping Complex, B BLock, Ranj" latitude="31.6512625666" longitude="74.8642998934" pagename="Tangerine Spa &amp; Salon"/><marker address="SCO, 109,Upper Ground Floor, Ranjit Avenue, Amrits" latitude="31.6568837613" longitude="74.8619073629" pagename="Kobe Sizzlers"/><marker address="Ranjit Avenue Market A Block , Amritsar - 143001" latitude="31.6490158202" longitude="74.8578357697" pagename="La patesserie"/><marker address="KFC, SCO Aventura Mall,35B/36/13, The Mall,Amritsa" latitude="31.6419624189" longitude="74.8709625006" pagename="KFC Restaurant"/><marker address="No.8, Lawrence Road, Amritsar - 143001" latitude="31.644394293" longitude="74.8769706488" pagename="Pizza Hut"/><marker address="Bansal Bakers, Lawrence road, Amritsar-143001" latitude="31.6471023896" longitude="74.8784512281" pagename="Bansal Bakers"/><marker address="#1, Central Mall Lower Ground Floor Mall Road Amri" latitude="31.6421428136" longitude="74.8692083359" pagename="Metro Shoes"/><marker address="Arshis Sub Zero, Lawrence road, Amritsar - 143001" latitude="31.6424168302" longitude="74.8756188154" pagename="Arshis Sub Zero"/><marker address="Wadrobe, Madan Mohan Malviya Road, Amritsar" latitude="31.6308900" longitude="74.8715520" pagename="Wardrobe"/><marker address="Wadrobe, Madan Mohan Malviya Road, Amritsar" latitude="31.6371966745" longitude="74.8752593994" pagename="Wardrobe"/></markering>
Top Expert 2014
OK, could you try with the simplest XML file you can build ?
Something like this one :

<?xml version="1.0" encoding="UTF-8"?>
   <marker address="Zapak" latitude="31" longitude="74" pagename="Station"/>

Open in new window

i did not understood ur answer fully!
Top Expert 2014

The XML is not parsed by GXml.parse
The question is why.
For testing purpose, I propose to you a new simple XML to check if the problem is the XML content
ok please wait a few seconds i do right now
my website is troubling now will post an update as soon as i get any reply

Sorry for delays
Top Expert 2014

Ok the one listing u provided me i added and it worked in ie8

So what next now
Top Expert 2014

Add some "pack" one by one do a try each time and wait until you get the error to know which "pack" is bad.
i am doing it 1 by one so it will take time
Top Expert 2014

Ok I used used StripHTML UDF aroud the dynamic build XML which made it appear on IE 8

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial