简体   繁体   English

当在新标签页中打开链接时,使用page.js的Polymer Routing不会将hashbang添加到URL

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

I am using polymer starter kit which uses page.js for routing. 我使用的聚合物入门套件使用page.js进行路由。 The hashbang page option is set to true in routing.html hashbang page选项在routing.html设置为true

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

when links such as <a href="/products/productname"></a> are clicked, the #! 当点击诸如<a href="/products/productname"></a>类的链接时, #! 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 . 添加,结果URL看起来像这样: http://localhost:3000/#!/products/productname但是当在新的浏览器选项卡中打开链接时,它们看起来像是http://localhost:3000/products/productname How can I have the #! 我怎么有#! added when links are opened in new tab? 在新标签页中打开链接时添加?

you have to write 你必须写

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

in every your href 在您的每一个href中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM