473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Ajax IE 7 and Vista

Hello,

I posted a thread a couple of days back RE using Ajax with JS to read
an XML file. This isn't working form me in IE 7 and Vista:

xmlhttp = new XMLHttpRequest();

xmlhttp.open("GET", url);

where url is a file on my local disk. This works in FireFox, and in
Safari but not IE. IE returns an "Access denied" error when trying to
access the file. This will not be a problem when it's deployed as it
will be reading a file from the server but this is messing up my
testing - anyone know how to configure IE security etc. to allow this?
I've tried usual things but all failing.

Ta

Ray
Dec 22 '07 #1
8 1388
rbrowning1958 wrote:
I posted a thread a couple of days back RE using Ajax with JS to read
an XML file.
If it was only a couple of days back then it would have been appropriate to
simply continue that thread you are referring to.
This isn't working form me in IE 7 and Vista:

xmlhttp = new XMLHttpRequest();

xmlhttp.open("GET", url);

where url is a file on my local disk. This works in FireFox, and in
Safari but not IE. IE returns an "Access denied" error when trying to
access the file.
Probably due to the MSXML's equivalent of the Same Origin Policy. As you do
not show the value of `url', let alone state the line in which the error
occurs, one can only make that educated guess.

http://www.jibbering.com/faq/faq_not...ml#ps1DontWork
This will not be a problem when it's deployed as it will be reading a
file from the server but this is messing up my testing -
Please be more specific about what you are doing.
anyone know how to configure IE security etc. to allow this?
I don't think that is possible. However, a local Web server for testing
would probably help here and it is a good idea anyway.
I've tried usual things but all failing.
That is a useless statement. What do you consider "the usual things"?
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Dec 22 '07 #2
On Dec 22, 4:54*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
rbrowning1958wrote:
I posted a thread a couple of days back RE using Ajax with JS to read
an XML file.

If it was only a couple of days back then it would have been appropriate to
simply continue that thread you are referring to.
This isn't working form me in IE 7 and Vista:
* xmlhttp = new XMLHttpRequest();
* xmlhttp.open("GET", url);
where url is a file on my local disk. This works in FireFox, and in
Safari but not IE. IE returns an "Access denied" error when trying to
access the file.

Probably due to the MSXML's equivalent of the Same Origin Policy. *As you do
not show the value of `url', let alone state the line in which the error
occurs, one can only make that educated guess.

http://www.jibbering.com/faq/faq_not...ml#ps1DontWork
This will not be a problem when it's deployed as it will be reading a
file from the server but this is messing up my testing -

Please be more specific about what you are doing.
anyone know how to configure IE security etc. to allow this?

I don't think that is possible. *However, a local Web server for testing
would probably help here and it is a good idea anyway.
I've tried usual things but all failing.

That is a useless statement. *What do you consider "the usual things"?

PointedEars
--
Prototype.js was written by people who don't knowjavascriptfor people
who don't knowjavascript. People who don't knowjavascriptare not
the best source of advice on designing systems that usejavascript.
* -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>
Hello PointedEars - cute name!

Thank you for taking the time to reply. I'll be more precise.
I didn't continue the original thread cos I fixed the errors I was
having there and narrowed it down to this simple stand alone problem.

I don't see how having the value of url or the line number will help
but seeing as you asked url is "xml/images.xml" and it's on line 28 in
my Javascript lol. It is an html file containing the javascript. It is
reading this XML file. I know it's failing on that line cos an alert
right after it never gets shown and IE reports the access deined error
if I tell it to report all errors in script. I am testing this
locally. When I get around to deploying it it will be on a Web server
which will have rights set up to allow access to the files on the
webserver. This for local testing.

By usual things I meant ensuring IE could run scripts, and that rights
for the folder were set to allow all access. I'll read up on same
origin policy - new to me. In fact all this is new to me. The I think
it's an IE security issue is cos it works fine in FireFox and Safari.
Just IE.

Thanks for taking the time to reply.
Ray
Dec 22 '07 #3
Ed
On Dec 22, 11:52*am, rbrowning1958 <RBrowning1...@gmail.comwrote:
I don't see how having the value of url or the line number will help
but seeing as you asked url is "xml/images.xml" and it's on line 28 in
my Javascript lol. It is an html file containing the javascript. It is
reading this XML file. I know it's failing on that line cos an alert
right after it never gets shown and IE reports the access deined error
if I tell it to report all errors in script. I am testing this
locally. When I get around to deploying it it will be on a Web server
which will have rights set up to allow access to the files on the
webserver. This for local testing.
I think you are seeing the problem described here:

http://dev.jquery.com/ticket/963
Dec 22 '07 #4
rbrowning1958 wrote:
I didn't continue the original thread cos I fixed the errors I was having
there and narrowed it down to this simple stand alone problem.
If there was no relationship to that thread at all, then referring to that
thread would not make sense either. You would not expect people to look it
up, now would you?
I don't see how having the value of url or the line number will help but
seeing as you asked url is "xml/images.xml" and it's on line 28 in my
Javascript lol. It is an html file containing the javascript. It is
reading this XML file. I know it's failing on that line cos an alert
right after it never gets shown and IE reports the access deined error if
I tell it to report all errors in script.
You should make improvements on the overall style of your postings if you
wish to be taken seriously in Usenet any further. This is _not_ chit-chat,
but a technical discussion which purpose is not only to analyze and solve
your problem (in the best possible way) but also to provide a learning
experience for other subscribers.

That includes, but is not limited to, *proper* quoting:

http://www.jibbering.com/faq/faq_notes/clj_posts.html
I am testing this locally. When I get around to deploying it it will be
on a Web server which will have rights set up to allow access to the
files on the webserver. This for local testing.
As I have said, you should set up a local test Web server so you can
reproduce the conditions on your remote production Web server. The file
system and HTTP are not equivalent, and if Ed's assumption is correct then
that would be exactly the cause of your problem.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Dec 22 '07 #5
On Dec 22, 7:55*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
rbrowning1958wrote:
I didn't continue the original thread cos I fixed the errors I was having
there and narrowed it down to this simple stand alone problem.

If there was no relationship to that thread at all, then referring to that
thread would not make sense either. *You would not expect people to lookit
up, now would you?
I don't see how having the value of url or the line number will help but
seeing as you asked url is "xml/images.xml" and it's on line 28 in my
Javascriptlol. It is an html file containing thejavascript. It is
reading this XML file. I know it's failing on that line cos an alert
right after it never gets shown and IE reports the access deined error if
I tell it to report all errors in script.

You should make improvements on the overall style of your postings if you
wish to be taken seriously in Usenet any further. *This is _not_ chit-chat,
but a technical discussion which purpose is not only to analyze and solve
your problem (in the best possible way) but also to provide a learning
experience for other subscribers.

That includes, but is not limited to, *proper* quoting:

http://www.jibbering.com/faq/faq_notes/clj_posts.html
I am testing this locally. When I get around to deploying it it will be
on a Web server which will have rights set up to allow access to the
files on the webserver. This for local testing.

As I have said, you should set up a local test Web server so you can
reproduce the conditions on your remote production Web server. *The file
system and HTTP are not equivalent, and if Ed's assumption is correct then
that would be exactly the cause of your problem.

PointedEars
--
Prototype.js was written by people who don't knowjavascriptfor people
who don't knowjavascript. People who don't knowjavascriptare not
the best source of advice on designing systems that usejavascript.
* -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>
Hello Pointy ears,

In the interests of becoming a well behaved citizen - and having read
the FAQ you pointed me to I don't see the error of my ways. What
quoting did I do incorrectly? Do you think I was chit chatting?

Thanks for your time

Ray
Dec 22 '07 #6
On Dec 22, 7:06*pm, Ed <e...@siliconforks.comwrote:
On Dec 22, 11:52*am,rbrowning1958<RBrowning1...@gmail.comwrot e:
I don't see how having the value of url or the line number will help
but seeing as you asked url is "xml/images.xml" and it's on line 28 in
myJavascriptlol. It is an html file containing thejavascript. It is
reading this XML file. I know it's failing on that line cos an alert
right after it never gets shown and IE reports the access deined error
if I tell it to report all errors in script. I am testing this
locally. When I get around to deploying it it will be on a Web server
which will have rights set up to allow access to the files on the
webserver. This for local testing.

I think you are seeing the problem described here:

*http://dev.jquery.com/ticket/963
Ed,

Spot on - thanks for that - it's allowed me to move forwards. I can
now read the file in both IE and FireFox - with IE using the Active X
(ActiveXObject("Microsoft.XMLHTTP")) and with FireFox using
XMLHttpRequest().

I've now run into some other compatibility between the two versions.
Both versions correctly read the XML file; I call my own routine from
the onreadystatechange event when state is 4:

req.onreadystatechange =
function() {
if (req.readyState == 4) {
preloadSlideshow(req);
}

So far so good and preloadSlideshow does indeed get called. Here's the
first part of it:

function preloadSlideshow(originalRequest) {
var slideshow = originalRequest.responseXML;
var slides = slideshow.getElementsByTagName('slide');
alert(slides.length.toString());
alert(originalRequest.responseText);

Both browsers display the responseText showing the entire XML file -
so they have both read it. The problem now is IE reports the number of
slide elements as 0, firefox correctly as 5. Is this another know bug?
Here's part of the XML file:

<slideshow>
<slide>
<image>images/slides/0013_arboretum_redbud.jpg</image>
<alttext>Photo: A very pretty picture</alttext>
<link>http://www.ucdavis.edu/about/</link>
<caption>A very pretty picture</caption>
<more>Scenes of UC Davis</more>
</slide>
<slide>
<image>images/slides/0016_aggie_band_trumpet.jpg</image>
<alttext>Photo: The Band-uh up close and personal</alttext>
<link>http://www.ucdavis.edu/sports_rec/</link>
<caption>The Band-uh up close and personal</caption>
<more>Scenes of UC Davis</more>
</slide>
...more here
</slideshow>

A bit frustrating all this!

Cheers

Ray
Dec 22 '07 #7
rbrowning1958 wrote:
function preloadSlideshow(originalRequest) {
var slideshow = originalRequest.responseXML;
var slides = slideshow.getElementsByTagName('slide');
alert(slides.length.toString());
alert(originalRequest.responseText);

Both browsers display the responseText showing the entire XML file -
so they have both read it. The problem now is IE reports the number of
slide elements as 0, firefox correctly as 5. Is this another know bug?
Yes, it is. If you insist on using `file:' instead of `http:', you will
have to work around that with

var objXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
objXmlDoc.loadXML(originalRequest.responseText);
var slides = objXmlDoc.getElementsByTagName("slide");

Unsurprisingly, setting up a local Web server, as I already recommended
twice, will also avoid that workaround.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Dec 23 '07 #8
On Dec 23, 12:51*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
rbrowning1958wrote:
function preloadSlideshow(originalRequest) {
* *var slideshow = originalRequest.responseXML;
* *var slides = slideshow.getElementsByTagName('slide');
* *alert(slides.length.toString());
* *alert(originalRequest.responseText);
Both browsers display the responseText showing the entire XML file -
so they have both read it. The problem now is IE reports the number of
slide elements as 0, firefox correctly as 5. Is this another know bug?

Yes, it is. *If you insist on using `file:' instead of `http:', you will
have to work around that with

* var objXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
* objXmlDoc.loadXML(originalRequest.responseText);
* var slides = objXmlDoc.getElementsByTagName("slide");

Unsurprisingly, setting up a local Web server, as I already recommended
twice, will also avoid that workaround.

PointedEars
--
Prototype.js was written by people who don't knowjavascriptfor people
who don't knowjavascript. People who don't knowjavascriptare not
the best source of advice on designing systems that usejavascript.
* -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>
Thanks for that. I'm not understanding what the code is doing if i'm
not specifiying File: or http: as part of the url. My code just calls
the get with a string for the file name, such as "xml/test.xml". If I
just run this HTML by opening it in IE (or actually from within
Dreamweaver as I'm doing) I suppose it is using file:. If I put this
within a virtual folder within IIS and then reference it using
localhost or whatever it is is this going to use http:? I'm think I'm
missing the difference here. Regardless it's still a shame that this
doesn't work the same way.

Thanks again for taking the tiem to reply - and I ack your other reply
RE toString(). I can't see it making any difference really except it
saves me typing it - I assume alert just calls toString() for all not
character data.

Cheers

Ray
Dec 23 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Prentice | last post by:
I am having dificulty debugging an ASP.NET Ajax (Novemver CTP) app on windows vista RTM. I have found the following interesting facts but cannot join the dots . . If my application is...
4
by: www.gerardvignes.com | last post by:
I'd like to join or start a small group of Ajax web developers who are willing to smoke test each others Ajax applications, quid pro quo. I can smoke test on W2K SP4 with IE6, FF2, SM 1 and O9. ...
9
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I followed first walk through sample from http://ajax.asp.net/docs/tutorials/IntroductionUpdatePanel.aspx to create my first testing page, The problem is after I clicked that botton, it...
4
by: NOTICIAS | last post by:
Hi everybody. A very basic web page using an ScriptManager and a RoundedCornersExtender fails loading at a shared hosting environment. In my local server, such page loads correctly. I'm...
0
by: Jobs | last post by:
C# , SQL Server , Vista , Ajax Interview questions links Full eBook with Vista , Ajax , SQL Server , UML and Architecture interview questions ...
13
by: Karl | last post by:
Hi all. I've recently rebuilt my Vista Ultimate workstation with Visual Studio Team Developer edition. Ive also put on the SQL Server 2005 tools and it's fully patched. I was building a web...
5
by: Sommer.pde | last post by:
It took me some time to find out when and why this happens. When the window of Internet Explorer is closed with an AJAX call still pending, something funny happens. Do it twice, and you will have...
2
by: =?Utf-8?B?c3Bw?= | last post by:
I have an ASP.NET AJAX WebApp with an Menu on master page. This menu has 4*5 items, every one with an image (small png files). Every time I browse a page in Visual Studio it takes about 5 ...
1
by: dotpranay | last post by:
I have developed a web app using ajax, it working fine in Win 2003 and also Win XP. But on Vista, the app is behaving weirdly, in some vista machines the app is not doing partial postback, in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.