javascript - Conflict with Ember.js and URL fragment (#) with Ecwid -
i'm using ecwid ember.js application, , ran conflict. in short, ecwid loads javascript embeds e-commerce store page. problem ecwid , ember both modify url fragment keep track of state, since ecwid inherently own single page application. basically, have 2 different js libraries fighting on url.
so when use ecwid component, url changes ecwid url, , ember complains assertion failed: route !/~/category/id=2104219&offset=0&sort=normal not found
because ecwid route, , not ember route.
i tried catch-all ember route, didn't work because ember state changes away page i'm on.
has had deal 2nd library fights ember on url? if so, how did maintain state , deal other application? pushstate , url fragments become more , more popular, image become more , more relevant.
really you're going have choose between two, if both using url routing of nature both rely on notion of base url, changing hash. in ember can disable location routing, lose routing capabilities of ember.
to disable routing you'll use nonelocation
nonelocation
using nonelocation causes ember not store applications url state in actual url. used testing purposes, , 1 of changes made when calling app.setupfortesting().
app.router.reopen({ location: 'none' });
i realize i'm saying this, i'm partially lying, because can use browser history
instead of hash. urls change so:
/emberhome/fooresource /emberhome/fooresource/foobar
instead of
/emberhome/#/fooresource /emberhome/#/fooresource/foobar
unfortunately there major drawbacks this, firstly server needs know serve ember app @ /emberhome , ignore nested locations. secondly browser support new (http://caniuse.com/history). thirdly, support recognizing ecwid won't supported, , blasted away when transitioning different routes.
app.router.reopen({ location: 'history' });
you can read more @ http://emberjs.com/api/classes/ember.location.html#toc_historylocation
Comments
Post a Comment