mechille
V2EX  ›  问与答

js 能写 URL 路由么?

  •  
  •   mechille · Mar 20, 2014 · 4426 views
    This topic created in 4614 days ago, the information mentioned may be changed or developed.
    看到过卜卜口用「hash实现换页不刷新」最终路径是

    url/abc/#!19d7b39 这样的

    如果配合rewrite有没有可能实现只考js(jquery)写一个路由格式像这样

    url/abc/19d7b39
    7 replies  •  1970-01-01 08:00:00 +08:00
    66beta
    66beta
    Mar 20, 2014
    1
    用js又不刷新的话,要在iframe里面做了吧
    haiyang416
    haiyang416
    Mar 20, 2014❤️1
    2
    不太理解楼主所指的路由需要那些功能,不过之前看过一篇文章讲过url修改的内容。
    http://www.ruanyifeng.com/blog/2013/07/how_to_make_search_engines_find_ajax_content.html
    mechille
    mechille
    OP
    Mar 20, 2014
    3
    @haiyang416 正是我想要的东西,非常感谢
    learnshare
    learnshare
    Mar 20, 2014
    4
    Angular 有这个模块,或者自己通过 history.pushState 自己写一下这个模块
    RIcter
    RIcter
    Mar 20, 2014
    5
    我曾经不用Angular只基于jquery写了个和卜卜类似的。。
    结果是其他都还好,在V那里js和html耦合的紧而且复用率为0....
    还是用了Angular..

    看了下这个是History api...
    赞( ̄▽ ̄),http://gather.whouz.com 就是用这个..
    YuHong
    YuHong
    Mar 20, 2014
    6
    Tiny ~1200 byte Express-inspired client-side router.

    https://github.com/visionmedia/page.js
    cyr1l
    cyr1l
    Mar 20, 2014
    7
    html5 history
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2274 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 12:06 · PVG 20:06 · LAX 04:06 · JFK 07:06
    ♥ Do have faith in what you're doing.