I'm trying to load this page in a UIWebView:
http://www.usopenofsurfing.com/on-demand/dvr
It works using Flash on a desktop browser, but has a different implementation when it detects iOS. It works just fine on Mobile Safari, but it's not working in the UIWebView.
Any idea why?
I've looked at the reported User Agents between actual Mobile Safari and the UIWebView.
UIWebView: iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206
Safari: iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3
The javascript which is switching between the flash and the iOS functionality simply looks for the strings ipad, iphone, or ipod:
var deviceAgent = navigator.userAgent.toLowerCase();
var is_iOS = deviceAgent.match(/(iphone|ipod|ipad)/);
So the User Agent should only come into play when choosing between Flash and iOS and that appears to be done properly.
Cookies may be the problem here.
To the best of my understanding, Cookies can not be sent with the first request from a Webview, but can be sent with subsequent requests to the same URL, if and only if, the first request was successful.
This causes problems with authentication services that require cookies to authenticate on the first request to the URL.
Also see this stack article and this apple documentation.
Related
I'm creating a special app where I'm using a WKWebView.
But I have one problem... WKWebView is acting different (outdated browser) than Safari (iOS version of Safari ofc).
If I visit adidas.com/yeezy on Safari, there is no problem.
But when I visit this site in WKWebView, it says that the browser is not modern enough.
I really need to fix this otherwise my app can't work.
Does anyone has a solution to make WKWebView "modern" ?
Thanks !
I believe it's just configuration. check out WKPreferences
I guess that if you enable whatever you can, you'll find the requested feature.. I'll check adidas to see if I find something special needed
EDIT:
Second option, you may trick the website that you are a different browser.
just set customUserAgent, see here.
You can see a working example in your Mac.
1) Open Safari
2) Development
3) User Agent
4) Other
Copy and past it to your code, Good luck!
Take for an example the next value:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.3.5
(KHTML, like Gecko) Version/11.0.1 Safari/604.3.5
EDIT: Example for swift 5 and XCode 10.2.1
Thanks Mr.G
testWebView.customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1"
I found this question while investigating a similar issue: my website works fine in Safari but not in Chrome for iOS.
If you visit http://whatsmyuseragent.org, you will likely notice that your WKWebView is using a different webkit version (60x.x.x) than Safari.
I am having an issue with this UA
Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/47.0.2526.107 Mobile/12H321 Safari/600.1.4
Site is written in React and using query like ?nexturl to navigate on access.It works fine on all other UA that i can find on simulators, but not this one.
Simply it doesn't work on my iphone6 and my ipad as well, which is hmm big issue. And if i switch to desktop UA, it works fine.
Even IOS 6,7 UA all works fine on simulate.
It is causing a looping refresh with the navigation above. No error produced, just refreshing.
Anyone have ideas what could be the problem?
I have a web page that when viewed from an iOS device displays slightly different content. To detect the device in question the site looks for iPad;, iPod;, or iPhone; in the user agent string.
This works perfectly on Safari on all iOS devices. Testing with Chrome for iOS it works on iPhone and iPad 1, but not iPad 3. The web site is getting the following (unexpected) user-agent string:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10
This seems to be related to the "request desktop site" option in the chrome menu (what would be the wrench icon in desktop chrome). For my site it's disabled and seems to be locked to the desktop rather than mobile site. For other sites, it's enabled and results in a different user-agent string being sent when selected. eg: try http://ifconfig.me/all
So my questions are:
what criteria does Chrome use to decide whether to enable this option
given that Chrome has forced this site to the desktop site, how do I render iOS specific content (in my case a link using a protocol that is handled by my app)
If you'd like to test this yourself, there's a page here that simply reflects the user-agent string.
http://minicompapp.com/Home/UserAgent
The browser will switch between using the two User Agent strings based on whether you are acting as a mobile browser of masquerading as the desktop browser.
User Agent:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-gb)
AppleWebKit/534.46.0 (KHTML, like Gecko)
CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
User Agent after "Request desktop version":
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3)
AppleWebKit/534.53.11 (KHTML, like Gecko)
Version/5.1.3 Safari/534.53.10
This is only a hint to the web server about who the client is. The browser should render the received web content independently of the User Agent.
I'm trying to view a users tweets from my app but twitter responses with a webpage saying:
Sorry that page is not supported on mobile at this time
However if i load the same URL with mobile safari i get a nice webpage with all the tweets.
I'm using this URL: http://mobile.twitter.com/SOME_USERNAME/tweets
You can reproduce the error message by visiting the url in safari. If you use safari as developer and you set the user agent to iPhone you'll get the right page.
It seems the webview is sending different headers as User Agent:
Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176
vs
Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3
Is there anything i could do about this problem?
Apperently it does work when i remove the /tweets part of the URL.
This is not really the answer to my question but it is the best option as long as nobody comes up with a better answer i'll accept this answer.
I'm pretty sure, that there were times, when I ran iOS Simulator, pointed Safari to some website and Safari was loading a iPhone-specific webpage. However recently it started to load content for desktop browsers, I'm quite sure, it's for plain Safari, not mobile one. iOS Simulator is pretending to be an iPhone with user-agent string like
Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3
When I put this string as user-agent string into desktop Safari and load, say, SO website, I can see non-mobile version, when I remove Simulator substring, I can see mobile-optimized SO main page.
I've no idea, what have happened, but I'd like to know, how to fix it, since I've spent a whole day catching a bug with JavaScript, and i realized that I was debugging on very different DOM.