带页面的聚合物路由.js在新选项卡中打开链接时,不要向 URL 添加哈希标记

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

本文关键字:链接 哈希标 添加 URL 聚合物 路由 js 选项 新选项      更新时间:2023-09-26

我正在使用使用page.js进行路由的聚合物入门套件。hashbang page选项设置为true routing.html

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

单击<a href="/products/productname"></a>等链接时,将添加#!,生成的 URL 如下所示:http://localhost:3000/#!/products/productname但是当在新的浏览器选项卡中打开链接时,它们看起来像这样http://localhost:3000/products/productname。如何在新选项卡中打开链接时添加#!

你必须写

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

在你的每一个 href