Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

我想知道我怎么能更改 从页面URL example.com/file1.html?i=1example.com/file1.html jQuery中 改变网页内容重新加载页面

  ask by Adel Tube translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
92 views
Welcome To Ask or Share your Answers For Others

1 Answer

Will change the URL without redirection or reload to file1.html.(将更改URL而无需重定向或重新加载到file1.html。)

If a history push state is not available to use the alternative.(如果历史记录推送状态不可用,则使用替代方法。) if (history.pushState) { window.history.pushState("{ Object }", "Title", "file1.html"); } else { document.location.href = "file1.html"; } Function(功能) function Change(domain, title) { let url = domain + 'file1.html'; window.history.pushState('data', `{$title}`, url); document.title = title; }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...