473,396 Members | 2,013 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,396 software developers and data experts.

AJAX and HTTPS

Hi,

Can anyone confirm is AJAX request can be sent over HTTPS if the
containing page is loaded via HTTPS? or is it true that all AJAX
interaction take place via HTTP? (Since the name of the class is
XMLHttpRequest and not XMLHttpsRequest)

Thanks,
Sameer

Feb 20 '06 #1
3 91270
sa******@gmail.com wrote:
Can anyone confirm is AJAX request can be sent over HTTPS if the
containing page is loaded via HTTPS? or is it true that all AJAX
interaction take place via HTTP? (Since the name of the class is
XMLHttpRequest and not XMLHttpsRequest)


First, there is no such thing as an "AJAX request". What is referred to
by the AJAX (commercial) buzzword now is still merely a well-known XML HTTP
request, i.e. a HTTP request initiated through a host object, implementing
an interface specified in or provided by the MSXML API, and the evaluation
of the corresponsing HTTP response through it. Hence the name of the MSXML
interface, IXMLHTTPRequest, and the host object that implements it.

Second, HTTPS is not another protocol, it is merely HTTP over an SSL/TLS-
encrypted connection. Since that encryption works transparent to the user
agent and so to the object described above, it should be entirely possible
to issue an HTTP request over that connection using that object, too, the
proper protocol part of the request URI ("https:") provided.

Since it works from location-bar script code --

javascript:var x = new XMLHttpRequest(); x.open('GET',
'https://bugzilla.mozilla.org/duplicates.cgi?sortby=delta&reverse=1&maxrows=100& changedsince=30');
x.onreadystatechange = function() { if (x.readyState == 4 && /^2
0/.test(x.status)) alert(x.responseText); }; void(x.send(null));

-- on <URL:https://bugzilla.mozilla.org/> in Firefox 1.5.0.1/Linux, you
should just give it a try.
HTH

PointedEars
Feb 20 '06 #2
Thomas 'PointedEars' Lahn wrote:
Since it works from location-bar script code --

javascript:var x = new XMLHttpRequest(); x.open('GET',
'https://bugzilla.mozilla.org/duplicates.cgi?sortby=delta&reverse=1&maxrows=100& changedsince=30'); x.onreadystatechange = function() { if (x.readyState == 4 && /^2
0/.test(x.status)) alert(x.responseText); }; void(x.send(null));


Grmbl. Someone[tm] stole the "|" from my original test code.
Should have been:

javascript:var x = new XMLHttpRequest(); x.open('GET',
'https://bugzilla.mozilla.org/duplicates.cgi?sortby=delta&reverse=1&maxrows=100& changedsince=30');
x.onreadystatechange = function() { if (x.readyState == 4 &&
/^2|0/.test(x.status)) alert(x.responseText); }; void(x.send(null));

The first version would work here too, because the status code of an
expected response would be within the 20x range. However, the second
version is more generic and handles requests on non-HTTP(S) resources,
too (which is not necessary here, though). See also

<URL:http://msdn.microsoft.com/library/en-us/xmlsdk/html/f6de15fc-72e9-418e-b275-d94b0b2045de.asp>
and
<URL:http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>
(or <URL:http://www.rfc-editor.org/rfc/rfc2616.txt>)
PointedEars
Feb 20 '06 #3
Thomas 'PointedEars' Lahn wrote:
<snip>
... . Since that encryption works transparent to the user
agent and so to the object described above, it should be
entirely possible to issue an HTTP request over that
connection using that object, too, the proper protocol
part of the request URI ("https:") provided.

<snip>

Just to be absolutely unambiguous; XML HTTP requests work over https
exactly as they do over http. If they did not our QA department would
have said something by now as they test over https almost exclusively,
and our web applications use web services (and so XML HTTP requests) so
extensively that they would not do much if they did not work.

Richard.
Feb 20 '06 #4

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

Similar topics

6
by: Arnaud | last post by:
Hi, I'm trying to translate an asp application in a php way, i'm using Php 4.3.x. I'm going to try an asp newsgroup too, but as it mainly deals with Php, I would like to submit you my probem :...
1
by: empiresolutions | last post by:
I am using this really neat and easy AJAX inline text edit script, http://www.yvoschaap.com/index.php/weblog/ajax_inline_instant_update_text_20/. It works great on localhost and HTTP. But, when i run...
1
gregerly
by: gregerly | last post by:
I've got a question regarding how AJAX calls are handled over HTTPS pages. On my site, I've got a signup form that collects credit card info. It's a three part form, 1. Enter personal Info 2. Enter...
1
by: saravj2ee | last post by:
Hi, I have implemented prototype.js file to use AJAX calls in my application. I need to call cross domain to get some value from different server. The HTML and prototype file are hosted in...
4
by: anaconda1977 | last post by:
From client side, I access with https. In my code alert(location.protocol) // pop up https new Ajax.Updater("sip_tab_content", "/rails/test_modules/show/" +...
3
by: anaconda1977 | last post by:
From client side, I access with https. In my code alert(location.protocol) // pop up https new Ajax.Updater("sip_tab_content", "/rails/test_modules/show/" +...
2
by: muiz123 | last post by:
Can we use AJAX to submit a https request in a http page? E.g. 1. Open a page: http://localhost/test.html. test.html code: <html> <head> <script src="script/sys.js" language="JavaScript"...
2
by: sekku | last post by:
When we are directly access the application from Application server(localhost).I am getting the correct response. This is URL ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.