Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a referrer URL on Angular 4?

How to get a referrer URL on Angular 4?? For example say example.com is my angular website, if example.com is visited from an another php page say domaintwo.com/checkout.php. How can I identify the the referenced url(domaintwo.com/checkout.php) from my angular website..?? Am looking for a solution like $_SERVER['HTTP_REFERER'] on PHP(same process needed on angular4). Thanks in Advance

like image 566
Sreejesh T S Avatar asked Jan 02 '23 18:01

Sreejesh T S


1 Answers

Have you tried?

document.referrer

According to W3C:

referrer of type DOMString, readonly

Returns the URI [IETF RFC 2396] of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

like image 136
emix Avatar answered Jan 05 '23 14:01

emix