Is there some way to open a new browser window but have it send a POST request to the server?
If not, is there some way to do this with AJAX (e.g. send an asynchronous POST request, get the response as an 'image/jpeg', open a new browser window, create a new image element within that browser window, and use it to display the image sent from the server)?
I had to do this for a recent project. You need to make a Ajax request to the server and have it return a url. You than use that URL returned in the responseText in the window.open()
One issue is pop up blockers blocked this.
Another solution is simple:
and another one that I think can be done, but have not tried:
Note the about:blank can be considered a security issue with https
Eric [ January 04, 2007: Message edited by: Eric Pascarello ]
Joined: Oct 13, 2006
Thanks for the suggestions Eric I ended up using a modification of your first one: I use an AJAX method to post the data to the server, where I then store it in a session attribute. Once that is finished, the client opens the new window, which calls the servlet to generate the image. That servlet gets the data from the session attribute, generates the image, and returns it to the page for display.
subject: Can I make a POST request for a new window?