Avatar of Scott Fell
Scott FellFlag for United States of America asked on

XMLHTTP not working in safari 5.1

This vbscript code does not work in safari 5.1.  It works fine in safari 6 and other browsers.

The page is at mysite.com/folder1/thispage.asp and is calling mysite.com/folder2/folder3/

I have a php on another domain and server calling the same thing by sending  a post and works fine as well.

Safari 5.1 just stops working at this point in the code.  In some cases, it downloads the asp page (just the rendered html).  When I take this out, all good.  I have tried loading this above all html and inside of html.  Same result.

      dim myData
		DataToSend = "d1=abc&d2=xyz"
		dim xmlhttp 
		set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
		xmlhttp.Open "POST","https://mysite.com/folder2/folder3/",false
		xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
		xmlhttp.send DataToSend
		Response.ContentType = "text"
		myData= xmlhttp.responseText
                Set xmlhttp = nothing

Open in new window

VB ScriptWeb Languages and StandardsMac OS X

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
Dave Baldwin

That doesn't make any sense.  That code runs on the server, not in Safari.  Any chance that the code that is being received is another complete page with <head> and <body> sections inside the <head> and <body> sections  of the main page?  Look at the 'View Source' and see if you're getting a properly formatted page when it works.
Scott Fell

Yes, I was planning on checking that out today.   However, I created a wordpress plugin/function using the php version and it hits the same exact page from an outside domain and that works fine.  

Originally, I thought it might be a log in issue because of the way safari handles sessions and redirects.  But as I put breaks in my code, this is what I was able to isolate.  I just found a mac with safari 5 I can test more on today.  

I did try removing the response.write portion completely and moving the httppost above the html and  inside the html.  Even without writing the data it fails.  The incoming data is just a series of div's and tables without much white space.  I threw it in the validator and all good.  I even check the validation on the WP site and and found some old sql injection(not pertaining to what I did of course) but it still works.
Dave Baldwin

I'm pretty sure that PHP and ASP will not generate 'exactly' the same code.  So the PHP version works and the ASP doesn't?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Scott Fell

The odd thing is it is only safari 5.1.  My client let me know and I confirmed it by finding a mac with 5.1.  It must be  the way xmlhttpost works on that browser.    I do want to test on some very plan content just to eliminate.  But the content it is loading is simply a series of h2 tags and tables and all validated.  I know there are multiple ways to send a  post and I may just use jquery ajax instead of classic asp.
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Scott Fell

yea, I will let you know when I test it out where the page it posts to will be just one word and nothing else.
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dave Baldwin

Cool, thanks for the points.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.