我在这里使用骨干样板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.htmlThis is URL for offline:
file:///C:/Users/MyHome/Desktop/MyProject/MyApp/index.htmlWhat 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.
更多推荐
发布评论