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
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

ASKER

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.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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?
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

ASKER

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.
SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Cool, thanks for the points.
Web Languages and Standards
Web Languages and Standards

Web development can range from developing the simplest static single page of plain text to the most complex web-based internet applications, electronic businesses, and social network services using a wide variety of languages and standards, including the familiar HTML, JavaScript and jQuery, ASP and ASP.NET, PHP, ColdFusion, CSS, PHP, Flex and Flash, but also the implementation of a broad list of standards including XML, WSDL, SSDL, VoiceXML and many more.

40K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo