Closed dev-samples closed 3 months ago
3.5.1
github.com
Navigate from this view:
<template> <div> <div class="about"> <h1>This is an about page</h1> </div> <nav> <router-link to="/another">Another</router-link> </nav> <router-view /> </div> </template>
to this view:
<template> <div class="another"> <h1>This is another page</h1> <!-- <p>Coming from (referrer): {{ myvar }}</p> --> </div> </template> <script> export default { name: "AnotherView", data() { return { myvar: "", }; }, mounted() { console.log("document.referrer", document.referrer); this.myvar = document.referrer; // Accessing the document content and referrer this.documentContent = document.documentElement.outerHTML; this.documentReferrer = document.referrer; console.log(" - - Document Referrer:", this.documentReferrer); }, }; </script>
That it prints the value/path of the previous (/about) route in the target route (/another)
It just print empty
Upgrading to a later version of vuejs is not an option at the moment. Did read: https://github.com/vuejs/vue-router/issues/883
but not sure if it what I am hitting here.
This is expected behavior in SPAs using history.pushState(). I recommend you using the Discord server if you need help with what you are trying to do regarding the document.referrer property
history.pushState()
Version
3.5.1
Reproduction link
github.com
Steps to reproduce
Navigate from this view:
to this view:
What is expected?
That it prints the value/path of the previous (/about) route in the target route (/another)
What is actually happening?
It just print empty
Upgrading to a later version of vuejs is not an option at the moment. Did read: https://github.com/vuejs/vue-router/issues/883
but not sure if it what I am hitting here.