WebView Error

Discussion in 'Mac Programming' started by sivaprakash, Apr 6, 2011.

  1. macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #1
    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/Vend...x=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
     
  2. macrumors 68000

    Sydde

    Joined:
    Aug 17, 2009
    #2
    Try %escape-coding your string (there is a method in NSString for doing this).
     
  3. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    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.
     
  4. macrumors 6502a

    Joined:
    Dec 2, 2008
    #4
    Debug Time!

    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?
     
  5. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #5
    @ Patrick - Answer for all your questions is YES. But it doesnt work in WebView only.
     
  6. macrumors 6502a

    Joined:
    Dec 2, 2008
    #6
    hmmm . . .

    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.
     
  7. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #7
    The simpler version of URLs are working well. Do I need to add any escape characters?
     

Share This Page