{"title":"隐藏跳转后的新网址 - JavaScript技巧","description":"本文介绍如何使用 JavaScript 代码隐藏跳转后的新网址,只显示老网址内容。通过location.replacehistory.replaceState 结合使用,可以实现无缝跳转,保持页面地址栏内容不变。","keywords":"javascript, location.replace, history.replaceState, 隐藏网址, 跳转, 地址栏","content":""location.replace("https://www.ygbxheb.cn/index1.html");\n这个JS怎么让其不显示跳转后的新网址,还是只显示老网址内容:要让跳转后的新网址不显示,可以使用以下代码:\njavascript\nlocation.replace(\"https:\/\/www.ygbxheb.cn\/index1.html\");\n\nhistory.replaceState(null, document.title, location.href);\n\n这样会在跳转后将新的网址替换为老的网址,并且浏览器地址栏只会显示老网址。"}

隐藏跳转后的新网址 - JavaScript技巧

原文地址: https://www.cveoy.top/t/topic/pSii 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录