views:

299

answers:

1

I have a form where you may press a button which will give you a PDF of the current information on the form. This is done by setting

window.location.href to the link to the pdf file.

After i do this, none of the javascript works on the page because all form elements have value of undefined.

The weird part is that the browser stays on the current page, but shows the download window.

is there a workaround for this?

+1  A: 

This probably won't behave the same in all browsers. Use a link instead and you will see better results.

<a href='link_to_pdf' target='_new' >
stevedbrown
any idea how to make a button that will do the same thing without using jquery and calling .click() ?
mkoryak
Couldn't you just wrap the button in that link?
dlamblin
Yeah, what dlamblin said.
stevedbrown