• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How can I get window.location.href in Nuxtjs V3

Resolved: How can I get window.location.href in Nuxtjs V3

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I’m trying to let players join a game via QR Code. Since that game will be hosted on several IP’s, i want to dynamically generate the URL.
This is my current workaround in my NuxtJS Vue Component:
What I want to do is something like:
When using useRouter() and useRoute()’s .fullPath attribute, I still only get the relative path / instead of http://10.16.1.173:3000/.
Full code on GitLab: pages/index.vue

Answer:

Try to check if you are in client side before accessing to ‘window’ object, you can use :

If you have better answer, please add a comment about this, thank you!

javascript nuxtjs3 vue.js
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: In Bigquery How iterate the records as per counter in the table

27/03/2023

Resolved: Java Swing center JLabel in JPanel with two JLabels

27/03/2023

Resolved: How to compare two text files and and change the sign of the data in powershell?

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.