2

I have built a web application using Marionette.js which is basically a wrapper around Backbone.js.

Problem Statement: I would like to detect invalid routes / URLs and trigger a function that redirects to 404 page.

What I've tried:

Hack #1

add an *invalid mapping to one of the controllers of my application as suggested.

Problem with this approach:

Not a good and maintainable solution since I have multiple apps with multiple controllers and just randomly adding invalid mapping to any of the controller doesn't sound a resonable solution.

Code: invalidPageModule + application.js

Hack #2

Extend History API with this method but my Marionette infused application does not seem to work on this solution.

Further readings of official documentation of Marionette and Backbone does not explain the concept of how to correctly extend History API in Marionette Framework.


Following are some related questions on Stackoverflow but none of them explain in detail on how to achieve the required behavior. (Please note that I'm a beginner in Backbone / Marionette.)

Community
  • 1
  • 1
InamTaj
  • 276
  • 2
  • 7
  • 15

0 Answers0