I am trying to modify the Discourse ember.js route
It currently displays a 404 page for the default route. Instead, I would like it to do a full page reload to try to fetch the path from the backend server, in case the path exists as static html or html served by the backend. For example, to be able to link to an static image.
http://ift.tt/2iy84pK describes the problem and the solution I'm trying to implement.
I tried changing unknown.js.es6
to be:
export default Discourse.Route.extend({
model(params) {
window.location.href = params.path;
}
});
When I click on the link to an image file (something ending in .png) The browser goes to a page that just has the Discourse header, with an empty body and then downloads the image. If I refresh the browser at this point, it shows the image directly in the browser without downloading it. I would like the behavior to be the same when clicking the link and refreshing the page. That is, not downloading the image ever.
I've also tried using window.location.reload();
in the model function, and this almost works, except when I go back in the browser, the previous pages don't reload ember.js, they just change the URL and keep showing the image.
How do I modify the ember.js routes/models to completely escape from the ember.js machinery and request the page from the backend server as though it were a completely new request?
Aucun commentaire:
Enregistrer un commentaire