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

LVL 54
Scott Fell,  EE MVEDeveloper & EE ModeratorAsked:
Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
It must be  the way xmlhttpost works on that browser

As I said above, it Can't be because the browser never sees that code.  That is run on the server.  The Only browser that will run any VBscript is Internet Explorer.  Even so, that code still runs on the server and not in the browser.  So it has to be something in the returned data, the content, that Safari 5.1 doesn't like.
Dave BaldwinFixer of ProblemsCommented:
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, EE MVEDeveloper & EE ModeratorAuthor Commented:
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.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Dave BaldwinFixer of ProblemsCommented:
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?
Scott Fell, EE MVEDeveloper & EE ModeratorAuthor Commented:
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.
Scott Fell, EE MVEDeveloper & EE ModeratorAuthor Commented:
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.
Scott Fell, EE MVEConnect With a Mentor Developer & EE ModeratorAuthor Commented:
This has been somewhat ongoing and I never figured it out although I stopped hearing complaints so I am just ignoring it.
Dave BaldwinFixer of ProblemsCommented:
Cool, thanks for the points.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.