olivernn / davis.js

RESTful degradable JavaScript routing using pushState
http://davisjs.com
532 stars 58 forks source link

Davis Router is not working FirefoxOS #102

Open nsisodiya opened 9 years ago

nsisodiya commented 9 years ago

In Firefox OS, We can use JS/HTML/CSS for app development.

Only difference is, it work with app:// protocol instead of http:// protocol

So, when I click on a <a href="/register"></a> then things are not working,

In normal browser setup,

Line number 1759 in Davis Router

   var route = self.lookupRoute(request.method, request.path);

here, request.path is equal to /register

But when I run the same code in FirefoxOS then

request.path is equal to app://3d97ccba-ab8c-4a3f-937f-fc894260b23c/register

So, Its a bug. I am digging more into it.

nsisodiya commented 9 years ago

I got the exact place of Error Somewhere in code, You are doing this.. line number 1459

raw.fullPath = raw.fullPath.replace(/^https?:\/\/.+?\//, '/');

So, I suggest for having a protocol based solution, Like instead of using hardcode string like http:, we can use variable like window.location.protocol