PDA

View Full Version : WebView Error




sivaprakash
Apr 6, 2011, 09:39 AM
Hi

I am trying to load an URL in WebView and I am getting an error "Browser not Supported. Please try a more recent version, or a different browser."

URL that I am trying to load (model)

https://xxxxx.xxxxxxxxxxxx.com/Vendor?xxxxx=none&xxxxxxx=none&xxx=3456&xxxx=4322&username=yyyy&password=*****


Code that I am using to load is

NSString *urlText ;

urlText = @"https://xxxxx.xxxxxxxxxxxx.com/Vendor?xxxxx=none&xxxxxxx=none&xxx=3456&xxxx=4322&username=yyyy&password=*****";

[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlText]]];


Can someone help me what is wrong in my code ? Or do I need to Upgrade. I may machine Safari is the default browser. But if use the browser to load this URL works fine I am facing issue only with the WebView at the same time other sites like www.google.com and others are working well.

Thanks
Siva



Sydde
Apr 6, 2011, 02:20 PM
Try %escape-coding your string (there is a method in NSString for doing this).

jiminaus
Apr 6, 2011, 04:01 PM
This doesn't sound like an error from WebView itself, but an "error" page that's being served from the web application you're trying to access. Try spoofing the user agent.

BTW WebView always uses Safari's WebKit engine regardless of your default browser. That is if you make Firefox your default browser, your program wouldn't start embedding Firefox into your window.

PatrickCocoa
Apr 6, 2011, 04:40 PM
Can you access that URL from Safari?
Can you access that URL from Firefox?
Can you access that URL from IE 6?
Can you access other URLs using your code?

sivaprakash
Apr 6, 2011, 08:23 PM
@ Patrick - Answer for all your questions is YES. But it doesnt work in WebView only.

PatrickCocoa
Apr 6, 2011, 08:38 PM
@ Patrick - Answer for all your questions is YES. But it doesnt work in WebView only.

As previously suggested, maybe there's some character in the URL that WebView doesn't like. The most unusual URL I ever load is:
@"http://www.highschoolsports.net/defaultcal.cfm?ct=s&schoolid=KS6621212106&spt=4&lvl=-1&divison=-1&timeoffset=300"

which works fine.

Maybe try simpler versions of your URL, starting with something basic and working up, adding complexity until it breaks. Start with:
@"https://xxxxx.xxxxxxxxxxxx.com/"

and see if that works.

sivaprakash
Apr 6, 2011, 08:46 PM
The simpler version of URLs are working well. Do I need to add any escape characters?