473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handler Does not work in Firefox

2 New Member
I created this generic AJAX Handler to work with Firefox and IE. However, it seems that somewhere in updating Firefox to 2.0.0.9 that the handler assigned to onreadystatecha nge is no longer getting called. This still works for IE.

Can someone help me add to this so that I can get it working with Firefox again?

Expand|Select|Wrap|Line Numbers
  1. var ASYNCH       = true;
  2. var REQUEST_TYPE = 'POST';
  3. var AJAX_URL     = '/ajax.cgi';
  4.  
  5. function httpRequest() {
  6.     // Mozilla-based browsers
  7.     if (window.XMLHttpRequest) {
  8.         ajaxRequest = new XMLHttpRequest();
  9.     }
  10.     // IE-based browsers
  11.     else if (window.ActiveXObject) {
  12.         ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  13.  
  14.         if(! this.ajaxRequest) {
  15.             ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  16.         }
  17.     }
  18.     // The request could still be null if neither ActiveXObject
  19.     // initialization succeeded
  20.     if (! ajaxRequest) {
  21.         alert("Your browser does not permit the use of all of this " +
  22.             "application's features");
  23.         return false;
  24.     }
  25.     ajaxRequest.onreadystatechange = this.handler; // DOES NOT WORK IN Firefox 2.0.0.9
  26.     ajaxRequest.open( REQUEST_TYPE, AJAX_URL, ASYNCH);
  27.     ajaxRequest.setRequestHeader("Content-Type",
  28.         "application/x-www-form-urlencoded; charset=UTF=-8"
  29.     );
  30.     ajaxRequest.send( this.queryString );
  31.     return true;
  32. }
Nov 7 '07 #1
5 2150
acoder
16,027 Recognized Expert Moderator MVP
Could you post the code for the handler?
Nov 7 '07 #2
Herkum
2 New Member
Could you post the code for the handler?
I think I did not make myself clear, the handler never gets called in Firefox. It works perfectly in IE and it HAD worked in Firefox before I upgraded it. So it is something specific to recent versions of Firefox.

I was hoping someone could help add some code to handle the problem that is occurring specifically to Firefox.
Nov 7 '07 #3
gits
5,390 Recognized Expert Moderator Expert
hi ...

have a look at the FF javascript-console ... are there any errors?

kind regards
Nov 7 '07 #4
Friends, try remove the code line follow:

ajaxRequest.onr eadystatechange = this.handler;

I tried it, and this works perfectly at the FF, Chrome and IE 6, 7 and 8.

Kind regards.
Oct 14 '10 #5
gits
5,390 Recognized Expert Moderator Expert
then there is no response-handler?? how ist the response handled now?

this.handler in the original post had to be a handler-function which would have been to be declared for the custom httpRequest function/object ... and it is missing in the posted code ... at least there should be something like:

Expand|Select|Wrap|Line Numbers
  1. ajaxRequest.onreadystatechange = function(response) {
  2.     // do something with response
  3. };
Oct 15 '10 #6

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

Similar topics

3
1784
by: Clarence Gardner | last post by:
I'm seeing surprising behavior, consistent across Opera, Firefox, and IE. An event handler is changing the value of an element, and there is apparently no Change event being generated for the element. A simple illustration is, make an INPUT element with an onchange; type in a new value, the Change event handler is called. But make a button whose Click handler changes the value, and the Change handler does not get called. It appears that...
1
3699
by: cjl | last post by:
Hey all: I'm trying to write a cross-browser (IE and firefox) event handler for the mousewheel. Basically my web app is an image viewer, so if you scroll "down" with the wheel the next image should be displayed and if you scroll "up" the previous image should be displayed. So far I have: function handleMouseWheel(e)
3
3159
by: jeff29_b | last post by:
I am having a strange problem on a web form. I have an image button with an OnClick event handler. When I click the image the event isn't being called in the code behind when browsing in firefox. I get the postback but I never have the event called. It works fine in i.e.
8
1889
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <script language="javascript" type="text/javascript"> function js_onsubmit_hndl_fn () {
4
7746
by: David McNerney | last post by:
Would anyone be able to tell me why I get an error in FireFox 1.5.0.1 for MacOSX when I type some text and hit Enter in the following form: <html> <body> <form action="http://example.com" onSubmit="return false;"> <input type="text" name="samplenum" value="" onChange="alert('onChange fired');"> <input type="submit" name="cmd_submit" value="Submit" onClick="return false">
2
21878
by: petermichaux | last post by:
Hi, I thought it is about time I tried writing some JavaScript with XMLHttpRequest instead of just using the Yahoo! UI library. The simple page below works in both Safari and Opera but I don't see the alert in Firefox. Looking in Firefox's firebug plugin, I see that the request is successfully sent and the correct response is received. Any ideas what is wrong? Thank you,
1
1493
by: VAXman- | last post by:
I have code which is created from a content mamagement system. It places some handlers on tags with in-line registration: <tag... onmousedown="mousedownHandler(this);" ...> I want to modified the handler and access the event. Here's an example of such (very contrived example): fucntion mousedownHandler(obj) {
3
689
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response per their MSDN policy. -------------------- I have a web site under .NET 2.0 that renders videos using the Silverlight media player. The web page looks like this: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="video2.aspx.cs"
2
4710
by: wolverine | last post by:
Hi All, In Mozilla Firefox, to onblur and onfocus event of each and every html element, the browser itself will attach a native event handler. I mean if you type, 'javascript:alert(window.blur)' in the address bar of Firefox browser, you can see a 'function ....' . That is a Firefox browser defined handler. Now assume that web developer also attach event handlers to 'onblur' events eg: 'window.blur=f3()'
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10578
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...
1
10321
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
10077
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...
1
7620
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
5522
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
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.