473,813 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why won't the android browser won't load and/or display my XML data?

57 New Member
I'm trying to find out why the android browser won't load and/or display my XML data. This javascript works fine on computer browsers (FF, IE, Safari, Chrome, Opera) and even in iPhone's Safari, but when I view the same page in my android's browser, nothing is displayed...it' s just blank. Is it a javascript bug in the android browser?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4.   function loadXMLDoc(dname) {
  5.     var xmlDoc;
  6.     if (window.XMLHttpRequest) {
  7.       xmlDoc = new window.XMLHttpRequest();
  8.       xmlDoc.open("GET",dname,false);
  9.       xmlDoc.send("");
  10.       return xmlDoc.responseXML;
  11.     }
  12.     // IE 5 and IE 6
  13.     else if (ActiveXObject("Microsoft.XMLDOM")) {
  14.       xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  15.       xmlDoc.async=false;
  16.       xmlDoc.load(dname);
  17.       return xmlDoc;
  18.     }
  19.     alert("Error loading document");
  20.     return null;
  21.   }
  22. </script>
  23. </head>
  24.  
  25. <body>
  26. <script type="text/javascript">
  27.   xmlDoc = loadXMLDoc("news.xml");
  28.   x = xmlDoc.getElementsByTagName('article');
  29.   for (i=0; i<x.length; i++) {
  30.     document.write("<span class='h2'>" + x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue + "</span><br />");
  31.     document.write("<span class='gray'>" + x[i].getElementsByTagName("date")[0].childNodes[0].nodeValue + "</span><br /><br />");
  32.     document.write(x[i].getElementsByTagName("text")[0].childNodes[0].nodeValue + "<hr />");
  33.   }
  34. </script>
  35. </body>
  36. </html>
  37.  
I wasn't sure if this should be posted in "Mobile Development" or here in "Javascript/Ajax/DHTML" so here it is...but thanks anyway for any insight you may have!
Jan 26 '11 #1
1 3110
JKing
1,206 Recognized Expert Top Contributor
Not having an android myself or ever having to develop specifically for it, I would say your best bet is to find some developer docs for the android and find out what it supports and what it doesn't support and then go from there.
Jan 26 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3076
by: wylbur37 | last post by:
How do you find out what version of JavaScript your browser supports? Is there a JavaScript function that will tell you? __________________________________ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003
2
1316
by: Alex Lee | last post by:
Hi, Does anyone know if its possible to tweak a browser (i.e firefox) on how it handles javascript. example: a java script turns something red (lets say the scroll bar) - feeds it to the browser - but the browser has been modify to execute a "red" attribute as blue - thus even when the script says to turn it red, it still outputs as blue! Thanks in advance.
1
2078
by: ebramcity | last post by:
Hi all I search for a way in javascript to prevent browser from caching my HTML page in its "history" and "temporary files" if there is any ... Thanx a lot.
2
11083
by: Lubo¹ ©lapák | last post by:
Hi, I need (in one function in aspx page) return the WWW browser back to previous page. How can I do it? Thanks
1
2582
by: coofucoo | last post by:
We need to draw a curve with javascript in different browser, like IE5+, firefox1+, mozilla1.2+. Is there any existed javascript framework or library we can use? Thank for your help!
2
2155
by: KC | last post by:
Hi, Every JavaScript executive context has a top-level window and we can use window.open() to open another window ... Does this related to Windows created by click on "File"->"New Window" or "File" -"New Tab" in browser's menu bar ? I think window created by "File"->"New Window" and "File"->"New Tab" are independent to each other from JavaScript's point of view. Is this correct ?
8
8951
by: wpelgrum | last post by:
When I open a webpage with javascript my browser (both IE6 and FF2.0.0.3) freezes anywhere from seconds to more than a minute. During that period, the browser is frozen and windows (XP-SP2) is very poorly responsive. There is no significant CPU-load. When I disable javascript in FireFox, everything works smoothly again. I have uninstalled MS javascript and SUN javascript, however, javascript is still being executed (when enabled in...
1
11378
by: sreedhardasi | last post by:
Hi, I would like to call a javascript function when user clicks on browser's close button. Here is the scenario. 1. User clicks browser close button. 2. User will be displayed a popup or a div with two buttons (Yes or No) by calling a Javascript function 3. "No" will close the window. 4. "Yes" will cancel the user action and redirect him/her to different
3
1894
by: goldenv | last post by:
Hi all, I have worked an open source javascript + html page that has the potential to replace your existing browser home page. If you are interested in trying it out, or learning more about it, it is freely available at http://code.google.com/p/tphp/ I would love to hear from you if you have any comments. Thanks, Vishal
0
10664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10417
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10139
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9220
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7678
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5568
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4357
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.