Search code examples
phpandroidmobile-websiteserver-variables

what is equivalent function of $_SERVER['HTTP_REFERER'] in mobile web application


I'm developing a PHP website as an application of Android, but there is a problem I stuck. I have a back button, where I write below logic using $_SERVER['HTTP_REFERER'] to find out the page from where it comes..but when I watch this website on android as application... it goes nowhere bcoz there is no $_SERVER['HTTP_REFERER']. I want to know how to go back to the android application. means

what is equivalent function of $_SERVER['HTTP_REFERER'] in android or mobile application.

Thank You.


Solution

  • The $_SERVER['HTTP_REFERER'] is always filled by the client. Every request can decide if it has this, it does not especially have something to do with android. There are enough people out there blocking the referrer for privacy reasons on desktops etc...

    You should not use the referrer for this, but figure out a different method. Maybe set some session variable yourself with 'last visited page' or whatever.