I'm trying to get the referral URL from where a specific route from my VueJS app was called.
The flow is:
- Route1 redirects to (outside) URL1 with a returnURL
- (outside) URL1 performs some actions and returns to returnURL
- ReturnUrl matches Route2 and shows a view (only if it comes from URL1)
I've tried with:
router.beforeEach((to, from, next) => {
console.log(to)
console.log(from)
next()
})
But the from
url is always /
. Also I tried with:
this.$route.query
(from How to get http refere in vuejs?)
And with plain JS with something like:
var referrer = document.referrer;
Finally I tried with this plugin without success.
The problem is that I don't have any clue if the user called directly the returnUrl
(forbidden) or it's a call from the outside service URL1
(valid).
It's this possible?
I checked: Can I get the referrer?