Window.Open POST

You cannot trigger a javascript popup and then force a post request.

Three options:

  1. Trigger a POST form with target="_blank" using javascript (but this doesn’t allow you to disable interface elements such as the menu bar).
  2. Open a popup locally, but don’t specify a url. Use the result of window.open to alter the document to generate a form, which you’d then post.

    var myWindow = window.open("", "", "height=600,width=800,scrollbars=1,location=no,menubar=no,resizable=1,status=no,toolbar=no");
    myWindow.document.write("Write a form here and then later on trigger it");
    
  3. You really shouldn’t do any of this. If it’s bad for users to copy urls, there’s a flaw in your application design.

  4. Added after edit: Use the ’empty window’ approach, but instead of writing a form and triggering it, do a an XMLHTTPRequest (with POST) in the parent. The result of this request can be used to populate the child-window.

Leave a Comment