|
|
#1 |
|
How do you block your website from Android phones?
I have a website that I'm making, but I only want it to work on iPhones, specifically the iPhone 5. I want an error message to show whenever someone tries to use an Android phone or computer to view the website.
What kind of code can I use to make this happen? Last edited by bonskovsky; Jan 17, 2013 at 10:08 PM. |
|
|
|
2
|
|
|
#2 |
|
Give it a rest, or look in the mirror. There's something very wrong with this picture.
|
|
|
|
5
|
|
|
#3 |
|
Java? Enable a pop-up that prevents anything but 6,1 (iPhone code name) from accessing the site.
|
|
|
|
0
|
|
|
#4 |
|
Why? To intentionally restrict your audience? That's like Apple coming out with a great product that can only be purchased in New York by women aged 23-30.
|
|
|
|
5
|
|
|
#5 |
|
No sure why you would want to do this, but there should be a way to identify the browser/device and throw up an error message.
|
|
|
|
0
|
|
|
#6 |
|
I'm testing this new game, it can only work on iPhones. There's a reason to do this.
Just to see if it works, I feel like I'd need to edit the code that it uses to detect whether or not it's a mobile phone to begin with. |
|
|
|
2
|
|
|
#7 |
|
Just remember you'll need to block out desktop versions off all browsers as well as the associated OSs as well.
|
|
|
|
1
|
|
|
#8 |
|
somehow, the code that i'm using automatically goes to mobile if on a mobile. so i just have to edit a little bit more code to make it more direct
|
|
|
|
1
|
|
|
#9 |
|
Just do a quick check of the referrer, and possibly the screen resolution too.
But remember these can all be faked - there's no known way to restrict to certain browsers/platforms that can't be circumvented. |
|
|
|
1
|
|
|
#10 | |
|
Quote:
.
|
||
|
|
3
|
|
|
#11 |
|
You could just have a separate page be redirected to based on the OS.
__________________
MacRumors Scavenger Hunt score: 3 |
|
|
|
0
|
|
|
#12 |
|
The browser making request to ur page customarily sends that information to u.
|
|
|
|
0
|
|
|
#13 |
|
I'm going to try it.
|
|
|
|
1
|
|
|
#14 |
|
I'm not aware of what web feature would work on iPhone 5's and nothing else but the easiest way to do this is to check the user agent string and only accept the iPhone 5's. This is relatively easy to bypass but gets the job done.
|
|
|
|
0
|
|
|
#15 |
|
Use the 'User-Agent' property from the request header.
Look for ipad or iphone in the string. Like Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16 I use regex just to match against iphone, so i don't have to worry about all the other version stuff |
|
|
|
0
|
|
|
#16 |
|
Well, Apple uses this method for iCloud.com. On my Galaxy Nexus, it tells me that "Android Browsers are not supported."
__________________
MacBook Pro (Mac OS 10.8.3), Galaxy Nexus (Android 4.2.2), iPhone 5 (iOS 6.1.4) |
|
|
|
0
|
|
|
#17 | |
|
Quote:
Writing non-standards compliant websites is bad when it is for IE, and also bad when it is for apple gear. Yes, you CAN do it with the user-agent string. Doing so is still bad. edit: If the game does not support android, put a disclaimer on the site. Don't just block access entirely.
__________________
MBP (early 2011) - Core i7 2720 2.2ghz, Hires Glossy, 16GB, Seagate Momentus XT 750GB Mac Mini (mid 2007) - Core2 Duo 1.8, 2gb, 320gb 7200 rpm iPhone 4S, iPad 4 |
||
|
|
2
|
|
|
#18 |
|
|
2
|
|
|
#19 |
|
Didn't think this guys threads could get better and he keeps proving me wrong.
|
|
|
|
4
|
|
|
#20 |
|
Yeah and someone got rid of the iPhone-stupor thread. I guess they didn't think it was a real issue, which it is, I think.
I don't care about anyone bypassing it. The website just won't show up correctly. There are apps that only work with the 5, like the little panoramic vibration app. |
|
|
|
0
|
|
|
#21 | |
|
Quote:
|
||
|
|
0
|
|
|
#22 |
|
sounds like technic cleansing
|
|
|
|
1
|
|
|
#23 | |
|
Quote:
__________________
View my flickr sets....if you want. They're not too exciting. |
||
|
|
0
|
|
|
#24 |
|
I still wanted to know why that happens to so many people. Because I think it's because of the way iOS is, is just a big long list of apps and they all look the same I just forget what I'm going to do.
|
|
|
|
0
|
|
|
#25 |
|
Android browsers allow users to change the agent to make it appear to not be a mobile device.
__________________
<\ \>tuntman |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 03:13 PM.







.
Linear Mode
