473,418 Members | 1,834 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,418 software developers and data experts.

Ajax issue with Internet Explorer (no error message either)

I have created a little chat application that seems to work 100% on Mozilla Firefox, Google Chrome, and Safari, (tried it in Opera, and it seems to work, but the cookies are screwing everything up; this is probably because my install is not being run under an administrator account), but not Internet Explorer.

Chat • Login
http://preview.moltx.name/chat_v2/library.js

Everything works fine, up until you get to the chat room itself. Internet Explorer just sits, and does nothing. Doesn't even have an error. It seems to be able to send data (but not fully; send a message using Internet Explorer, and then check the active users list on another browser), and is completely non responsive to data received.

It's made with JavaScript + PHP.
Nov 27 '08 #1
15 2371
I have repaired one issue but it didn't solve the problem with Internet Explorer properly displaying what it receives.

Internet Explorer was sending two messages when submitted; one empty, one of the content you have submitted. I put a server-side filter to prevent empty messages from being submitted (since it also causes a bug with the other browsers) so now the messages submitted from Internet Explorer appear on the other browsers properly.

Does this have anything to do with Internet Explorer, not supporting the World Wide Web Consortium Document Object Model perhaps?
Nov 27 '08 #2
acoder
16,027 Expert Mod 8TB
The most probable reason is that IE is caching the response, so no further requests to the same URL are made. To disable caching, add some headers, or make the URL unique, e.g. by adding the timestamp.
Nov 28 '08 #3
I've added the following headers to my server's response for every page:
  • Content-Control: no-cache, must-revalidate
  • Expires: -1
  • Pragma: no-cache

Nothing appears to have changed, except on Firefox, which appears to no longer "not do anything" (once in a while, it wouldn't actually reload the page containing the script, causing the server to not reset the message counter, and thus not receive all messages).

I cleared my history/cache/cookies on Internet Explorer on both of my computers several times. With no change in behavior of the script.

Even if it was caching the response, it should at least receive one message, "Connected.," no matter what from my server and after receiving it, it should automatically strip the <p>Connecting...</p> from the chat log, and from the users list, and replace the one in the chat history with, "Connected.," and the one in the users list with the username (colored green) that you signed in with.

Please note that if you're testing this out, you're not really "registering" on the site, just use any old username to "log in" (it doesn't really require you to be registered in any way, hence no password box) and it will add it to the database temporarily to track which room you're in and whatnot, to send the messages you have not received yet when the script queries for them.

I also tried the timestamp thing by adding +"&timestamp="+unixTime () to the XMLHttpRequest.open url, and same thing; no change in script behavior.
Nov 28 '08 #4
acoder
16,027 Expert Mod 8TB
I notice that you have this in your code:
Expand|Select|Wrap|Line Numbers
  1. if (window.IExplore)
  2.                             {
  3.                                 document.write (this.responseText);
  4.                             }
I'm not sure what it's for, but using document.write() after the page has loaded has unexpected results. It reopens the page for writing. If you want to add content to the page after loading, use appendChild().
Nov 29 '08 #5
That is not there for "functional" reasons. I use document.write when I can't seem to figure out what is going wrong to just "dump" variables to the page, and which on IE, it's not receiving any data for it to dump, so if that actually worked... I'd remove it, knowing that the variable there isn't the cause of IE not working.

So right now that's definitely not causing any problems. It will need to be removed in the future when I do figure out what's wrong with IE, but right now it's there so that once I do fix the problem with data not coming in it'll be like "DING <?xml version="1.0" encoding="UTF-8" ?><messages><type>history</type><number>1</number><message><content>Conntected.</content></message></messages>" right in the middle of the screen. A hallelujah moment!
Nov 30 '08 #6
Alright, it looks like it is an issue with appendChild in Internet Explorer. It is supported, but in a different way. I spent about an hour searching Google for what was going wrong, but now need to find a solution.
Nov 30 '08 #7
Never mind, I have no clue any more. I dumped a document.write and wrote all the text to the screen on all browsers but Internet Explorer, which points the blame finger back to XMLHttpRequest.
Nov 30 '08 #8
It appears as if "this." anything is underfined in Internet Explorer. Is there any way to have this. populated properly?
Nov 30 '08 #9
acoder
16,027 Expert Mod 8TB
See this. You might try explicitly adding it. Using an object for the Ajax calls should also solve this problem.
Nov 30 '08 #10
According to that guide (which seems to explain everything in the exact way I was pretty sure it was handled) it is working as expected in Firefox, Opera, Google Chrome, and Safari, but not in Internet Explorer. It only mentions one thing about Internet Explorer with a specific function; attachEvent sends it as a reference, causing this to be a reference to window rather than the element that it is a child of.
Nov 30 '08 #11
Well, I fixed the XMLHttpRequest issue; this is not inherited properly on Internet Explorer it seems, period. So I'm never mucking around with that until the 8th version of Internet Explorer comes out; we'll see what it can do right for once.

Anyways with that out of the way the W3C DOM method is causing problems in Internet Explorer (I'm actually getting errors, thankfully). However, I don't know why, especially with the check in place.

It's giving me an error on line 140; the script automatically checks if it is set or not; if it is, then it goes to line 140, and grabs the data. But Internet Explorer is claiming it's set when it's not.
Nov 30 '08 #12
Okay, I guess I repaired that issue; used element.length > (0) rather than typeof (element [0]) !== 'undefined'.

Now it's giving me a Type Mismatch on the removeChild statement I've got on line 222 or 223.
Nov 30 '08 #13
Text is being displayed! Major progress!
Nov 30 '08 #14
Fully functioning now. :)

Thank you for your help guys.
Nov 30 '08 #15
acoder
16,027 Expert Mod 8TB
Great work. I learnt one or two things from this thread because I don't usually code XMLHttp in the way that you did. Thanks for all the progress reports. It helps when users post at each step. Finally, I'm pleased for you that you got it working :)
Dec 1 '08 #16

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

Similar topics

1
by: Girish Pal Singh | last post by:
Internet Explorer is unable to access the form and its elements. Even server side generated scripts give error. Same code runs fine on other browsers. Whats the problem? I have IE 6.0 on...
0
by: Florin M | last post by:
I am running a custom application developed with ASP.NET 1.1, C# and Visual Studio 2003. I recently installed SP2 for XP Professional. When I close the Internet Explorer window where the app...
3
by: Jason | last post by:
I have a web page that contains textareas. These are dynamically added via asp when the page loads based on database records. The user also has the ability to add more text areas via innerhtml. ...
2
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet...
0
by: bazubwabo | last post by:
hi everybody, I currently use oracle 9i forms developer for to build some forms ,and however by running the form ,i've gotten an internet explorer error message:"Internet explorer has encountered a...
3
by: Kosmos | last post by:
Hey ya'll...I can't seem to figure out why I'm getting this error message, but it all started when I added the new line of code with the recSet5.AddNew --- when I ran the first line, the logic worked...
3
by: JanaAnandh | last post by:
In my application, When trying to Logout getting internet explorer error message. This error is observed in Win 2000 but not in Win XP machines. Please help me out to resolve the issue.
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.