Calling a url with window.location.assign?


I’m calling a url with window.location.assign inside of method action but i got this error : “UnrecognizedURLError” which come from the recognize error.

PS: I’m using Ember 3.3


Could you share your code? “UnrecognizedURLError” typically means Ember can’t recognize the routes you’ve given it so it seems like it could be a bad URL. Is this internal to your application or is it an external link?

If it’s an internal URL (e.g. points to somewhere in your ember app) is there any reason you’re not using link-to or transitionTo?

Well the URL is a rest api external to the current application. For example "window. Location.assign(“api/v1/extract/excel”).

My goal is being able to call this URL without the router.

Hope it help

Thk again

Are you trying to load data from that URL? If so you’d either want to either use Ember Data or just make an ajax request to that URL instead of any window.location methods. Using window.location.assign doesn’t really make sense in an Ember application (unless you’re trying to redirect away from the ember application).

If the API returns HTML and doesn’t support json content-type then things are going to get weird.

thk for the reply, i know it doesn’t make sense but yes i need to call a url outside of Ember, maybe i will try to make an ajax request.