Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Gregory Grondin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic