Polymer Routing with page.js do not add hashbang to URLs when links are opened in new tab

北战南征 提交于 2020-01-06 01:31:05

问题


I am using polymer starter kit which uses page.js for routing. The hashbang page option is set to true in routing.html

// add #! before urls
page({
  hashbang: true
});

when links such as <a href="/products/productname"></a> are clicked, the #! is added and the resulting url looks like this: http://localhost:3000/#!/products/productname but when the links are opened in a new browser tab, they look like this http://localhost:3000/products/productname. How can I have the #! added when links are opened in new tab?


回答1:


you have to write

<a href="#!/products/productname"

in every your href



来源:https://stackoverflow.com/questions/30925003/polymer-routing-with-page-js-do-not-add-hashbang-to-urls-when-links-are-opened-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!