views:

79

answers:

1

I'm trying to log in into a web page through an iPhone app. I'm using a NSURLConnection to try to connect. The app seems to be logging in correctly but I'm then getting redirected to a page that says I can't continue without Javascript enabled. I'm running all of this through the iPhone simulator that comes packaged with xcode. The curious part is that when I navigate to the same web page with the same information in safari in the iPhone simulator I don't get this reconnect, it sends me to the page I want.

Why is using the NSURLConnection giving me this redirect if I have Javascript enabled in the simulator and can navigate to it outside of the app? Thank you for any help.

+1  A: 

NSURLConnection does not interpret javascript. Safari does interpret javascript. If you need it to interpret javascript use UIWebView and actually display the webpage.

Your webpage should implement "graceful degradation". Which just means your site should work without any javascript. You can find plenty of documentation about graceful degradation if you google.

Conceited Code
Unfortunately that is not an option because I am not the owner or operator of the website and have no way of getting those changes to be made. But you did let me know what I needed to know so thank you.
E. Criss