0

I have a UIWebView into a mobile website that I run, and would like to hide some links when it's seen by the WebView--but not mobile Safari. It seems like there's several approaches to this:

  1. Evaluate custom Javascript to hide elements of a certain class.
  2. Pass in a GET parameter so that the server does it.
  3. Pass in a custom header so that the server does it.
  4. Maybe something else...

To me it seems like they all have their tradeoffs. What's the best way of doing it?

2 Answers 2

0

If you want to do this, I'd say detecting the UA with JavaScript is probably the way to go because it will be added automatically, and you can concentrate on the website, rather than having to add code to both.

Also, you don't have to check every time a link is clicked to add a custom header or GET parameter.

1
  • Come to find out UIWebViews have a custom UA anyway--it contains the app name. Very convenient.
    – tsm
    Commented Jun 12, 2013 at 2:41
0

What I do to make the distinction between UIWebview and mobile Safari is using the userAgent (a custom one for the webView). Based on the UserAgent I display different content for each "platform"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.