I want to use the default behavior of a browser to open a pdf file in a new tab using Ember.
I'm not using Ember-Data and as a server side resource I'm using Python. So I set the proxy address on startup of Ember to point to server side address.
I built a route page and I have a link to open my PDF file in the browser like
<a href="/path/apps/list.pdf?list=current" target="_blank">Open</a>
And the server Python resource returns a pdf:
@get("/list.pdf")
@params(C.String("list"))
def get_list_pdf(list):
//some code to build the pdf string
Response(pdf_string, headers={'Content-Type': 'application/pdf'})
I tried it in an application without ember to access the resource from a link and it is fine. But with Ember I'm not able to do that.
I got this error: Uncaught UnrecognizedURLError: /path/apps/list.pdf?list=current ember.debug.js:4914
Any suggestions how I can achieve that?
As a solution to my problem I created a new route and I added to its template the html object element. I added also a {{link-to 'the route' (query-params url='the url') }} to transit to the route to render the PDF.
The template.hbs
<object data={{url}} type='application/pdf' />