Reputation: 1261
Is there an easy way to check via php or javascript whether it's "my iPad". Basically, I'd like to do some mobile testing and hope to use a function:
if (itsMine()){
//do stuff
}
(I know that one way would be to check the ip address, but it would be great if there were something ipad specific)
Upvotes: 3
Views: 179
Reputation: 9007
I'm not familiar with the iPad, but I would be surprised, scratch that, I'd be flabbergasted if there was such an option.
Such an option would mean any iPad would be individually trackable without the owners consent or knowledge. If there was such an option it woild not remain for long.
Your best option is to use cookies. Create a page on your site that leaves a specific cookie on the device and test for it.
Upvotes: 1
Reputation: 53921
You could use a 3rd party non-safari browser that allows you to set the user agent. Set it to some unique value, and check it with JavaScript PHP.
Upvotes: 0
Reputation: 458
Use a hashtag. You call for it by putting #mine
after the URL.
if(location.hash == "#mine") {
// do something
}
Upvotes: -1
Reputation: 1224
There's no foolproof way of checking for this, without resorting to usernames and passwords. The closest you'll get is a combination of IP address and user agent ($_SERVER['REMOTE_ADDR']
and $_SERVER['HTTP_USER_AGENT']
). However you should bear in mind, that whilst they may be okay for your needs, they are not foolproof and can be spoofed, and therefore should not be relied on where security is an issue.
Upvotes: 0
Reputation: 2441
I'd setup a, possibly secured, page that sets/unsets a unique Cookie and use that to determine whether it's "you" or not.
Upvotes: 3