I have two ways to get to my chat.php page. One way is via profile page link and the other is via the menu. My question is, how can I know in chat.php, where the page is loaded from?
Asked
Active
Viewed 44 times
0
-
You can use `$_SERVER['HTTP_REFERER']` – Serghei Leonenco Jul 20 '20 at 04:10
-
I advise against using $_SERVER['HTTP_REFERER'] as it can be easily spoofed – Clement Sam Jul 20 '20 at 04:18
-
@ClementSam I agree with you but unfortunately, it is a "take it or go home" deal. Referral: https://stackoverflow.com/questions/21807604/preventing-curl-referrer-spoofing – Serghei Leonenco Jul 20 '20 at 05:05
-
I have been trying something similar here https://stackoverflow.com/questions/62834971/how-to-override-previous-page-redirect – Jul 20 '20 at 15:26
1 Answers
0
I understand require this information using javascript, if it is the case use referrer
const referrer = document.referrer;
MDN
The Document.referrer property returns the URI of the page that linked to this page.

Mario
- 4,784
- 3
- 34
- 50