#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    256
    Rep Power
    13

    Redirect script issue


    I'm trying desperately to make a geolocation page and I've been somewhat successful however...I've had to incorporate a script to run to test to see if the user is on a mobile device so that if their privacy settings are on, they are redirected to a certain page. OK...that works. Problem is that now it's redirecting Safari and Chrome, when it shouldn't be...unless of course they're on a mobile device.

    Code:
    if (geoPosition.init()) {
      navigator.geolocation.getCurrentPosition(success, geoError);
    } else {
      alert('Geo Location is not supported');
    }
    function geoError() {
      self.location="anotherpage.html";
    }
    ?
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    I don't see any checks for mobile devices in your code. You simply try to get the position, and if it fails (for whatever reason), you do the redirect.

    When running the library in Chrome, I get a PositionError (code 2) saying

    Code:
    Network location provider at 'https://www.googleapis.com/' : Returned error code 404.
    If you check Google, that seems to be a common issue.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo