How can I get the next / direct url using javascript?

We have a function to get the return / past url using: document.referrer , so is there a way or function to get the "direct" url?

I just want to know if there are backlinks or direct links on the current page. I searched a lot in history and session history, but they are very limited due to some security issues.

Is there any way to get the following url?

+4
source share
2 answers

You cannot read the story object. Your script has no way of knowing which URL the forward button will move to, or if it is available at all.

+1
source

Unfortunately, there is no software way to retrieve the forward or reverse history from the browser. This is a precaution. You can only run a history movement and not view any entries.

A similar question ... How to access browser history?

To confirm the W3C states in the "5.5.2 History Interface" section of the following specification http://dev.w3.org/html5/spec/history.html#the-history-interface

"Actual entries are not available from the script."

Change , and I would add that this is the only place where information is available. If you are developing an extension, you can track the URLs yourself, keeping the current URL in stock, otherwise you are out of luck.

+2
source

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


All Articles