7

I have a link which when clicked I open a window with window.open like below.

 window.open("edit.jsp?clientId=" + clientId + "&eventId=" + eventId , 'height=600,width=800,scrollbars=1,location:no,menubar:no,resizable=1,status:no,toolbar:no');

I dont want the parameter to pass here instead I want to something like post so people cant copy url .

asked Apr 5, 2011 at 16:06
1
  • 5
    This questions looks similar: window.open post Commented Apr 5, 2011 at 16:14

3 Answers 3

16

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.

answered Apr 5, 2011 at 16:16
Sign up to request clarification or add additional context in comments.

Comments

7

Beside AJAX (jquery.load()), which I would use myself - how about the following approach:

<form method="post" action="edit.jsp" target="_blank">
 <input type="hidden" name="clientId" value="88"/>
 <input type="hidden" name="eventId" value="2"/>
</form>

target = _blank will actually open a new window /tab the posted data will be processed in. Unfortunatelly you can hardly control the new windows appearance.

answered Apr 5, 2011 at 16:18

Comments

0

How about implementing a model popup window using a div? You can make an http post call to load the content of that div/model popup. You can use jQuery load() method to load the content of the div as well.

http://api.jquery.com/load/

Some other model popup plugins are here

http://jquery.com/demo/thickbox/

http://colorpowered.com/colorbox/

http://fancybox.net/

answered Apr 5, 2011 at 16:14

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.