aspose file tools*
The moose likes Applets and the fly likes Opening a new browser window from the applet and supplying data via POST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Opening a new browser window from the applet and supplying data via POST" Watch "Opening a new browser window from the applet and supplying data via POST" New topic
Author

Opening a new browser window from the applet and supplying data via POST

Gregory Grondin
Greenhorn

Joined: Jun 11, 2012
Posts: 5
I've got a request in to add a button to one of our applets that will launch a web page in a new browser window.

We've done this before using getApplet().getAppletContext().showDocument(url, "_blank"); with any data we want to supply added to the URL's query string (usually encrypted and URLEncoded).

This time around though I'm being told that they want the data submitted via POST. My understanding is that this is not directly or easily doable without some intermediate steps.

Any thoughts or suggestions?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42627
    
  65
It would be tricky, to say the least. One approach might be for the applet to call a JavaScript method on the same web page that the applet is on, passing along any data it needs. The JavaScript could then create an HTML form on the page that contains all the data, and submit that via a POST to a new window (using target="_blank" in the form). The form could be in an invisible IFrame, so that the user doesn't see it.

I'm not sure if this would work, but I don't see a fundamental problem why it wouldn't.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Opening a new browser window from the applet and supplying data via POST