473,586 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML works on IE & FF, how do I get it to work with Safari ?

31 New Member
I have modelled my program on the std code below (from http://www.w3schools.c om/dom/dom_parser.asp) ..

It works in IE & Firefox, but does not work with Safari - nor does Safari issue the alert "Your browser cannot handle this script" !

I've seen elsewhere on this forum that Safari supports HttpRequest, but this is new technology for me. My XML is very simple (only 7 data items).

- Is there a simple way to get the script below to work on Safari ?
- if not, can someone point me to a simple explaination of how to implement HttpRequest?
. - thanks

[HTML]<html>
<head>
<script type="text/javascript">
var xmlDoc;
function loadXML()
{
// code for IE
if (window.ActiveX Object)
{
xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async=fa lse;
xmlDoc.load("no te.xml");
getmessage();
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.imple mentation &&
document.implem entation.create Document)
{
xmlDoc=document .implementation .createDocument ("","",null) ;
xmlDoc.load("no te.xml");
xmlDoc.onload=g etmessage;
}
else
{
alert('Your browser cannot handle this script');
}
}function getmessage()
{
document.getEle mentById("to"). innerHTML=
xmlDoc.getEleme ntsByTagName("t o")[0].childNodes[0].nodeValue;
document.getEle mentById("from" ).innerHTML=
xmlDoc.getEleme ntsByTagName("f rom")[0].childNodes[0].nodeValue;
document.getEle mentById("messa ge").innerHTM L=
xmlDoc.getEleme ntsByTagName("b ody")[0].childNodes[0].nodeValue;
}
</script>
</head><body onload="loadXML ()">
<h1>W3Schools Internal Note</h1>
<p><b>To:</b> <span id="to"></span><br />
<b>From:</b> <span id="from"></span><br />
<b>Message:</b> <span id="message"></span>
</p>
</body>
</html>[/HTML]
Sep 30 '07 #1
1 1155
acoder
16,027 Recognized Expert Moderator MVP
See this XML importing script.
Oct 1 '07 #2

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

Similar topics

2
2498
by: David | last post by:
On every web browser except Safari, this website works great. (Well, by "every" I mean Mozilla, Netscape, and Internet Explorer, for Mac and Windows). The site is: http://www.ruleofthirds.com (the problem does not exist on the first page... just all the other pages, so you'll have to click on something to see the problem) The problem...
2
2284
by: Steve Lockridge | last post by:
We have recently created simple javascript rollovers on a site using Macromedia Fireworks. What is weird is that four of them work and one doesn't on the Mac platform using Safari and IE. The NN and Camino browsers work. Before I give you the URL, I wanted to let you know I am not referring to the swap image behavior. I am referring to...
2
11510
by: Mike | last post by:
My page populates a table with a list of names and other information from a JavaScript object. I receive changes (adds, change & delete) to that list, convert it into a JavaScript object. I do understand how to add the new names to the list. I have 3 questions: 1) How can I search through the table rows to find the rows to be changed...
5
1900
by: S | last post by:
Whew! Thanks for your help on that last post. I actually understand what you wrote. I'm trying not to use these groups as a way to get my code written for me, I really want to understand what I'm doing wrong (and right!) so your explanations have been very helpful. I really appreciate them. My last problems involve DIV sizing and MSIE Win...
24
1800
by: abracad_1999 | last post by:
I'm told the standards way of referencing page content is document.getElementById() What is the lowest version of each browser type with which this will work? Thank you
4
5607
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in FireFox and Safari it appears as a narrow column of text with only 2-3 words per line. Here is the code: function showAll()
8
4544
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text VALUE="Select and drag this text"> <SPAN >Select and drag this text</SPAN> <TEXTAREA>Select and drag this text</TEXTAREA>
6
1793
by: digleif | last post by:
I'm struggling to fix an annoying CSS problem. I've built a nav bar in a table and use css to control the hover state, which colours the background of the table cell. In every browser I've tested it works fine, but in Safari (1.3.2) the table breaks between cells causing extra space to appear. The nature of this project is such that it HAS...
4
1812
by: AG | last post by:
Using ASP.NET 3.5 I have been using a standard menu control bound to a sitemapdatasource using a web.sitemap file. The menus work fine in IE and Firefox, but in Safari, they render horribly and dynamic menus don't work at all. I found a post indicating that rendering can be improved by modifying browserCaps, but not the dynamic...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7959
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...
0
8216
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...
0
6614
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...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
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...
1
2345
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
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.