¿Cómo puedo obtener el document.referrer.refferer? Quiero decir, como el referente del referente del documento actual.
Usé el document.referrer en mi sitio aquí:
function statistics() { if(window.location.href.indexOf("statistics") > -1 && history.length) { history.back() } else if(window.location.href.indexOf("games") > -1 && history.length) { window.location.replace(document.referrer + "/../tournament.html"); } else { window.location.replace("./tournaments/tournament.html"); } }El propósito es "recordar" de dónde viene el usuario.
Ahora existe la posibilidad de ir a un sitio de configuración desde ese sitio donde se encuentra este código. Por lo tanto, el código necesario equivalente sería:
function nftStatistics() { if(window.location.href.indexOf("statistics") > -1 && history.length) { history.go(-2) } else if(window.location.href.indexOf("games") > -1 && history.length) { window.location.replace(document.referrer.referrer + "/../tournament.html"); } else { window.location.replace("./tournaments/tournament.html"); } }Sin embargo, este código no funciona, porque document.referrer.referrer no existe. Espero que puedan ayudarme y encontrar una solución ya que no puedo resolver este problema por mi cuenta.
ya he probado
Solución , lamentablemente, esto no es posible por razones de privacidad, así que simplemente modifiqué la URL mientras visitaba la siguiente URL. El código para eso se ve así:
function nftMarked() { if (window.location.href.indexOf("#statistics") > -1 && history.length) { window.location.replace("./nft.html#statistics=profile?=" + document.referrer); } else if (window.location.href.indexOf("#games") > -1 && history.length) { window.location.replace("./nft.html#games=profile?=" + document.referrer); } else { window.location.replace("./nft.html"); } }volviendo a 'document.referrer.referrer' se ve así ahora:
function nftStatistics() { if(window.location.href.indexOf("#statistics") > -1 && history.length) { history.go(-2) } else if(window.location.href.indexOf("#games") > -1 && history.length) { var url = String(window.location); url = url.split("=").pop(); window.location.replace(url + "/../tournament.html") } else { window.location.replace("./tournaments/tournament.html"); } }Conclusión Si me preguntas, esta solución no es tan limpia y puede reenviar a tus usuarios a cualquier otro sitio web si editan su URL, pero es la única solución que se me ocurrió. Entonces, si tiene alguna idea mejor, estaría muy feliz de saber de usted.