Backbone样板路由器的根目录,用于离线和预生产(Backbone boilerplate router's root for offline and pre

编程入门 行业动态 更新时间:2024-10-24 02:33:35
Backbone样板路由器的根目录,用于离线和预生产(Backbone boilerplate router's root for offline and pre-production)

我在这里使用骨干样板https://github.com/tbranyen/backbone-boilerplate

我在离线静态html / js中进行开发并在线上进行测试,然后再在线上传到另一个预生产站点。 令我恼火的是路由器在预生产中工作但不是脱机。 这是pre的root :

var app = { // The root path to run the application. root: "/myfolder/" };

这是在线预生产的URL:

http://www.mywebsite.com/myfolder/index.html

这是离线的URL:

file:///C:/Users/MyHome/Desktop/MyProject/MyApp/index.html

我在脱机时使用什么root ? 有没有办法在每次上传到预生产时都不要改变root ? 或者路由器根本不在静态html中工作?

ps这是main.js中的代码

Backbone.history.start({ pushState: true, root: app.root });

I am using the backbone boilerplate here https://github.com/tbranyen/backbone-boilerplate

I do development in static html/js offline and do test offline before uploading to another pre-production site online. What annoyed me is that the router works in pre-production but not offline. This is the root for pre:

var app = { // The root path to run the application. root: "/myfolder/" };

This is the URL for online pre-production:

http://www.mywebsite.com/myfolder/index.html

This is URL for offline:

file:///C:/Users/MyHome/Desktop/MyProject/MyApp/index.html

What do I use for root in offline? Is there a way NOT to keep changing root every time I upload to pre-production? Or does router not working in static html at all?

p.s. This is the code in main.js

Backbone.history.start({ pushState: true, root: app.root });

最满意答案

没关系。 执行一些读取后,pushState不能与文件协议一起使用

https://github.com/mtrpcic/pathjs

http://html5doctor.com/history-api/

HTML5 Mozilla文档虽然没有说明这一点。

Never mind. After doing some reading, pushState does not work with file protocol

https://github.com/mtrpcic/pathjs

http://html5doctor.com/history-api/

The HTML5 Mozilla document doesn't say this though.

更多推荐

本文发布于:2023-04-29 12:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336298.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:离线   根目录   路由器   样板   Backbone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!