user-agent

Detect iPhone browser in .htaccess/apache and redirect to iPhone site

混江龙づ霸主 提交于 2020-01-12 02:41:28
问题 Is it possible to detect iPhone browser agent in .htaccess and redirect the user to the correct iPhone page? 回答1: Sure you can - #redirect mobile browsers RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$ RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301] RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$ RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301] RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$ RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301] Taken from here 回答2: A little Googling,

How do I show an error page when users visit my site using Microsoft Edge?

不问归期 提交于 2020-01-11 11:39:11
问题 When a user loads my website in Microsoft Edge, I need to show a page like in the below image: I can see like this page when I'm trying to access sites like www.naver.com or www.daum.net on Edge. That page looks like a Provided from Microsoft , and I guess there are Any Javascript function to call this pages I need to know how .. 回答1: If possible you should avoid browser detection and move to modern web technologies that work across browsers. A great tool you can use is the sitescan on http:/

Android mobile user agent?

随声附和 提交于 2020-01-10 17:59:09
问题 I'm currently making an android application for a forum, basically it just loads the website in a webview and that works fine and all, but I'm trying to add an option to view the full site or the mobile site. I got it working by just making a boolean BrowserType which when set to true, loads the mobile site in the webview, and when set to false, loads the full page. I already have it working and everything, the full site loads and I jsut have the user agent as "Chrome", and I set the mobile

Detect mobile browser (not just iPhone) in python view

女生的网名这么多〃 提交于 2020-01-10 06:55:18
问题 I have a web application written in Django that has one specific page I'd like to implement a mobile version of the template (and slightly different logic) for. I'd like to be able to implement it ala this sudo code: def(myView) do some stuff if user-is-on-a-mobile-device: do some stuff return (my mobile template) else: do some stuff return (my normal template) I don't have a huge amount of time and I'm pretty early on in my coding learning curve :) - I found what looks to be a very powerful

Detecting iPhone 5 and any iOS device below it

岁酱吖の 提交于 2020-01-10 04:04:40
问题 A question was asked on SO about the iPhone 4 user agent and the iOS 5.0 user agent. I use the following to detect different mobile devices, viewport and screen. I'd like to be able to distinguish between the iPhone 5 and all other iOS devices. As far as I know, the line I'm using to detect the iOS 5.0 user agent var iPhone5 would also apply to any iOS device running iOS 5.0, so technically it's incorrect. var pixelRatio = window.devicePixelRatio || 1; var viewport = { width: window

Setting a custom userAgent in HTML or JavaScript

烂漫一生 提交于 2020-01-10 03:45:25
问题 Is there any way to do this? I'm trying to send a GET request to a website, but I want to customize my UserAgent. Is there any way to do this in pure HTML and JavaScript? I'd like it to all execute locally. 回答1: This is working for me. Object.defineProperty(navigator, 'userAgent', { get: function () { return 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0)'; } }); It is an updated version of code4coffee's answer as Object.prototype.__defineGetter__() is deprecated:

Tell iPadOS from macOS on the web

限于喜欢 提交于 2020-01-09 19:56:29
问题 The user agent of Safari on iPadOS beta is at this point exactly the same as Safari on macOS. Is there any other way to tell an iPad from a Mac? iPad running iOS Mozilla/5.0 (iPad; CPU OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 Mobile/14G60 Safari/602.1 iPadOS, developer beta 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15 iPadOS, beta 2, simulator Mozilla/5.0 (Macintosh; Intel Mac OS X 10

How can I set the “User-Agent” header of a UIWebView in Swift

不羁岁月 提交于 2020-01-09 12:51:12
问题 I am using Xcode 6 for an iOS App with Swift. I have got a simple ViewController with an embedded UIWebView. You can find the code below. Now I want to change the User-Agent HTTP header. I tried to use the setValue method of NSURLRequest but it didn't work (see uncommented line). Does anyone know how to do that? import UIKit class WebViewController: UIViewController { @IBOutlet weak var webView: UIWebView! override func viewDidAppear(animated: Bool) { var url = NSURL(string: "https://www

How to request the desktop version of a webpage in Swift 2

落花浮王杯 提交于 2020-01-07 03:53:07
问题 I've tried to request the desktop version of a webpage in this way but it doesn't work and I can't find anything on the web to help me let url = NSURL(string: "*****") let request = NSMutableURLRequest(URL: url!) let newUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.6 Safari/537.11" request.setValue(newUserAgent, forHTTPHeaderField: "User_Agent") webView.loadRequest(request) Could you please help me? 来源: https:/

User agent stylesheet overriding border styles

筅森魡賤 提交于 2020-01-07 02:26:23
问题 First off, let me say I am pretty new to coding in general, so please be specific in your responses =) I am having an issue with borders around images on a site I am working on. You can see the site here: http://eventswithvizability.ca/ I have 10 images rotating on page reload, you can see the HTML here: <SCRIPT LANGUAGE="Javascript"> function banner() { } ; b = new banner() ; n = 0 b[n++]= "<IMG name=randimg CLASS='aligncenter1'>" b[n++]= "<IMG name=randimg CLASS='aligncenter2'>" b[n++]= "