简体   繁体   English

Page.js:不是Hashbang而是Hash?

[英]Page.js: Instead of Hashbang just Hash?

Right now if page.js generates urls they look like this: 现在,如果page.js生成网址,它们将如下所示:

http://mysite.dev/#!/contact

Well I have the option to disable the hashbang completely and make urls look like this: 好吧,我可以选择完全禁用hashbang,并使网址看起来像这样:

http://mysite.dev/contact

But that gives me the problem, that whenever I refresh the URL, I get a failed get request. 但这给了我一个问题,就是每当刷新URL时,我都会收到一个失败的get请求。

I would rather have just a hash , like this: 我宁愿只是一个hash ,像这样:

http://mysite.dev/#/contact

Is this somehow possible? 这可能吗?

If you'd prefer to completely remove #! 如果您想完全删除#! and # is to set up your server to always respond to requests with your homepage, no matter the route. #是将服务器设置为无论路由如何都始终响应您的主页请求。 Then your javascript can decide whether to show a page or 404 not found. 然后,您的JavaScript可以决定是显示页面还是找不到404。

After checking the page.js code, it seems that your only option is a hashbang. 检查page.js代码后,似乎唯一的选择是hashbang。

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

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