Javascript document.referrer with full request

I am trying to get the full link url to a page through javascript.

So far in the closet I came

var lastUrl = document.referrer;

This does not include a request attached to the URL.

var lastUrl = document.URL;

returns the current URL with an intact chain.

In any case, it’s easy to get the link URL along with the link request.

+4
source share
1 answer

You can not. You can move the user to the previous page using

window.history.back();

but you won’t know what the URL is. You can only get this:

document.referrer

I know this is not a complete url request, but it is referrer.

P.s. , , ? URL-, .

+5

Source: https://habr.com/ru/post/1540731/


All Articles