HTTPS Relative XMLHttpRequest

M

MC

Dear Group,

I have searched and found references by pointy-ears and Cornfed that it
is possible to do a relative addressed secure XMLHttpRequest but nowhere
can I find a sample of how to do it, nor can I figure it out. Can
someone please present an example or link to such?

Thanks!
 
T

Thomas 'PointedEars' Lahn

MC said:
I have searched and found references by pointy-ears and Cornfed […]

Please do not feed the troll (adjust your score-/killfile instead).


F'up2 where it belongs

PointedEars
 
T

Tim Streater

Stefan Weiss said:
MC said:
I have searched and found references by pointy-ears and Cornfed […]

Please do not feed the troll (adjust your score-/killfile instead).

A troll, you say? Would that be the person who asked a legitimate JS
related question, or the one who tried to divert replies to
alt.my.little.pony?
I'm sure most readers of this group are able to make their own decisions
about how to score posters. We generally don't feel the need to announce
every filter adjustment in our postings, however.

Back on topic...
@OP: Yes, it is possible to use relative URLs in the XHR's open()
method. The URL will be resolved relative to the base URL of the current
document/window (see the XHR specification(s) for details).

In fact that's all I ever use.

See:

<http://www.clothears.org.uk>
 
T

Thomas 'PointedEars' Lahn

Stefan said:
MC said:
I have searched and found references by pointy-ears and Cornfed […]
^^^^^^^^^^^^^^^^^^^^^^^
Please do not feed the troll (adjust your score-/killfile instead).

A troll, you say? Would that be the person who asked a legitimate JS
related question, or the one who tried to divert replies to
alt.my.little.pony?

It is the person who started calling long-time contributors to this
newsgroup names (literally), while *pretending* to not know. As that
was obviously not obvious to some rather naive people (like you), I have
attempted to point out the history of the OP. As for "legitimate JS
related question": you can't be serious.


PointedEars
 
M

MC

MC said:
I have searched and found references by pointy-ears and Cornfed […]

Please do not feed the troll (adjust your score-/killfile instead).

A troll, you say? Would that be the person who asked a legitimate JS
related question, or the one who tried to divert replies to
alt.my.little.pony?
I'm sure most readers of this group are able to make their own decisions
about how to score posters. We generally don't feel the need to announce
every filter adjustment in our postings, however.

Back on topic...
@OP: Yes, it is possible to use relative URLs in the XHR's open()
method. The URL will be resolved relative to the base URL of the current
document/window (see the XHR specification(s) for details).
If the current URL uses the "https" scheme, you should be fine. If the
scheme, domain, or port parts of the URL you want to request differ from
the current base URL, you're going to run into problems with the
browsers' same origin policy. But in that case, there's not much point
in using relative URLs, anyway.
There may be ways to relax this restriction, but I'd need to know more
about your use case before I can recommend one. Please also describe
what you have already tried and what did/didn't work for you.
F'up2 where it belongs

Duly ignored.


- stefan

Stefan,

I'm trying to clear up the browser mixed-mode error in the URL. The page
is delivered via Https and all of the resources are relative addressed
including the XmlHttpsRequest. The research I done seems to suggest I
need to do an explicit Https XmlHttpsRequest to resolve the error.

This is what I'm using for my XmlHttpsRequest:
myXmlHttpRequest.open("POST", "/ws/webserviceXYZ.jsp");
myXmlHttpRequest.onreadystatechange = myResponse;
myXmlHttpRequest.send(myPostData);

I do not want to do the following as the domain is different in testing,
production, and in affiliate modes:
myXmlHttpRequest.open("POST",
"https://www.mydomain.com/ws/webserviceXYZ.jsp");

From what you posted, the XmlHttpRequest should be defaulting to Https
since the page was accessed from it. Chrome is complaining it is not
though. Any help is greatly appreciated as I am not a troll. Pointy-ears
just does not like it when one of the lesser JS smart people vocalize
their disappointment in his depredations on their skills and character.

MC
 
M

MC

Stefan Weiss said:
MC wrote:
I have searched and found references by pointy-ears and Cornfed […]
Please do not feed the troll (adjust your score-/killfile instead).

A troll, you say? Would that be the person who asked a legitimate JS
related question, or the one who tried to divert replies to
alt.my.little.pony?
I'm sure most readers of this group are able to make their own decisions
about how to score posters. We generally don't feel the need to announce
every filter adjustment in our postings, however.

Back on topic...
@OP: Yes, it is possible to use relative URLs in the XHR's open()
method. The URL will be resolved relative to the base URL of the current
document/window (see the XHR specification(s) for details).

In fact that's all I ever use.

See:

<http://www.clothears.org.uk>

Tim,

Yes Stefan pointed this out but in the example I replied to, Chrome does
not seem to be doing this.

Thank you,
MC
 
M

MC

Who is the troll?

Me who asks a question - or you who waits under the JS bridge, waiting
for some poor unsuspecting soul to cross, and have you jump on them
spewing your greatness and chewing them out for not being as smart as you.

I would just really like to ask questions of the group and have you not
respond AT ALL but hey its the Internet and if you want to troll I guess
you will. ...and what is up with the alt pony thing? You are WEIRD!
 
S

Scott Sauyet

MC said:
Who is the troll? [ ... ]

Children, children! Play nicely together!

Mica, stop calling Thomas names. Thomas, stop calling Mica names.

Now run along and behave!

-- Scott
 
M

MC

FYI,

I found it. Chrome apparently complains if an unsecure request is made
on another page and doesn't really discriminate because its the same
site...kind of strange I think as almost all sites make use of public
non-secure and private secure pages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top