search

Home  >  Q&A  >  body text

javascript - webpage url jump

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!

仅有的幸福仅有的幸福2753 days ago850

reply all(4)I'll reply

  • phpcn_u1582

    phpcn_u15822017-06-12 09:30:38

    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>

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-12 09:30:38

    Bound click jump event

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-12 09:30:38

    <a>1</a>
    <a>2</a>
    <a>3</a>
    
    $("a").click(function() {
      window.location.href="xxxxx"
    })

    reply
    0
  • 某草草

    某草草2017-06-12 09:30:38

    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...

    reply
    0
  • Cancelreply