Firefox 重定向部分错误
Firefox redirect section bug
我正在尝试通过以下 link 重定向到我网站的价格部分:https://www.paydomestic.com.br/#pricing
<a href="https://www.paydomestic.com.br/#pricing"></a>
Google chrome 正常工作,已经在 firefox 中不工作。
但这只会通过 link 发生,如果您在浏览器中输入 url “https://www.paydomestic.com.br/#pricing” 并按回车键,但不会通过 link!
这是为什么?
已解决
<script>
/*location.hash returns the anchor part of an URL as a string,
with hash (#) symbol included. */
//wait for page elements to load
//execute function only if the anchor exists in the URL address
window.onload = function() {if(location.hash){
//remove # from the string
var elId = location.hash.replace('#','');
//locate the anchored element on the page by its ID property
var scrollToEl = document.getElementById(elId);
//scroll to the anchored element
scrollToEl.scrollIntoView(true);
}
}
</script>
我正在尝试通过以下 link 重定向到我网站的价格部分:https://www.paydomestic.com.br/#pricing
<a href="https://www.paydomestic.com.br/#pricing"></a>
Google chrome 正常工作,已经在 firefox 中不工作。
但这只会通过 link 发生,如果您在浏览器中输入 url “https://www.paydomestic.com.br/#pricing” 并按回车键,但不会通过 link!
这是为什么?
已解决
<script>
/*location.hash returns the anchor part of an URL as a string,
with hash (#) symbol included. */
//wait for page elements to load
//execute function only if the anchor exists in the URL address
window.onload = function() {if(location.hash){
//remove # from the string
var elId = location.hash.replace('#','');
//locate the anchored element on the page by its ID property
var scrollToEl = document.getElementById(elId);
//scroll to the anchored element
scrollToEl.scrollIntoView(true);
}
}
</script>