bugfix: separate query vs hash URI overrides

This commit is contained in:
Leon van Kammen 2025-05-08 17:21:21 +02:00
parent 755682b6e1
commit b2b8bfd03b

View file

@ -21,8 +21,11 @@ window.AFRAME.registerComponent('xrf', {
let searchIsUri = document.location.search &&
!document.location.search.match(/=/) &&
document.location.search.match("/")
if( searchIsUri || document.location.hash.length > 1 ){ // override url
this.data = `${document.location.search.substr(1)}${document.location.hash}`
if( searchIsUri ){ // override url
this.data = `${document.location.search.substr(1)}`
}
if( document.location.hash.length > 1 ){
this.data = this.data.replace(/#.*/,'') + document.location.hash
}
}