Reputation: 649
Right now I'm using...
window.location.pathname != "/x_Controller/x_View"
Is there any way to get just the "x_View"? Thanks.
Upvotes: 1
Views: 1368
Reputation: 4951
You can just do a substring of the window.location.pathname
var pathname= window.location.pathname;
var endURL= pathname.substring(pathname.lastIndexOf('/') + 1,pathname.length);
EDIT
As Galactic suggested this won't get you the action name if it has any route values on the end like actionName/12
. What you really want to use is
var [email protected]("action").RawValue;
That will get you the actual name of the Action instead of just the stuff after the last '/'
Upvotes: 2