javascript - How to track referrer of referrer in web api -


i have page - https://example.com/addproduct/

assume user has come page page b https://referrer.com/.

an ajax request being fired on page create product - /api/products/ [post].

i page (https://pagea.com/addproduct/) referrer in products api want referrer of page i.e. page b in api. best way achieve it?

should pass javascript in request body or http header? there other way?

as long page , page b under site. when user navigate page b page a, can put identifier whenever user click navigation element on page b.

example on page b, have :

<button onclick="navigate()">go page a<button> 

then,

<script type="text/javascript">    function navigate(){      var currentlocation = window.location.href;      window.location = "http://yoursite.com/?addproduct="+currentlocation;    } </script> 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -