javascript - webpage url jump
仅有的幸福
仅有的幸福 2017-06-12 09:28:38
0
4
845

Why don’t many websites use a tags for url jumps? F12 can’t see any jump information on the tags, but it can jump urls when clicked. How to do this? Or did something else happen? So that I can't see any data from the tag that f12 can't see? I was confused for a moment. It was the first time I saw such f12. After studying it for a long time, I still didn’t understand how to implement it in js!

仅有的幸福
仅有的幸福

reply all(4)
phpcn_u1582

js jump, give me an example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

<button id="btn">Go</button>

<script>
var btn = document.getElementById("btn");
btn.addEventListener("click",function(e){
    window.location.href="https://segmentfault.com";
});
</script>    
</body>
</html>
習慣沉默

Bound click jump event

过去多啦不再A梦
<a>1</a>
<a>2</a>
<a>3</a>

$("a").click(function() {
  window.location.href="xxxxx"
})
某草草

Currently single pages generally use history.pushState
https://developer.mozilla.org...

vue-router

vue-router default hash mode - uses the hash of the URL to simulate a complete URL, so when the URL changes, the page will not be reloaded.

If we don’t want an ugly hash, we can use the routing history mode, which makes full use of the history.pushState API to complete URL jumps without reloading the page.

https://router.vuejs.org/zh-c...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template