How Would You Redirect a Mobile Webpage based on Carrier?
I'm havin开发者_Go百科g some difficulty Googling the answer for this.
Basically I have a page, then I want to redirect them based on Carrier (for example, Sprint, Verizon, Tmobile, etc). So if they are Verizon, they get sent to a Verizon specific-page.
The only information I would have is the IP, hostname, etc. I wouldn't be asking for any information such as their phone number.
By the looks of it, would this be done with hostname? Is there a list available of all mobile carrier hostnames?
Servers have hostnames, clients usually do not. Do you know yours?
The only thing you can do is a reverse IP lookup. This could give the name of ISP that is hosting the client IP, from where the request is comming. See this: http://whatismyipaddress.com/
The only limitation is that user has to be on carriers network. So most non-carrier wifi networks will not get you correct info.
The best way to do this is to use the TelephonyManager. Create a list of carriers then and compare also make sure to have a default case as there maybe cases where the carrier name has changed or you didn't add something to your list.
TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String name = telephonyManager.getNetworkOperatorName();
You can use Handset Detection with the Javascript mobile detection method.
If you setup a site profile with no detection rules you can write custom javascript to access HandsetDetection.isp then redirect them where ever you like.
Hope that helps. (Disclaimer: I work there).
精彩评论