3

I want to open a popup window for a printview and I have to pass the object id as get-parameter.

var w = window.open('http://example.com/print/?id=42');

But JavaScript cuts the querystring at this point and destroys my url.

http://example.com/print/

Is this a security feature? What can I do to pass the parameter? I cannot use nice urls. :(

Daniel
  • 539
  • 4
  • 25

1 Answers1

1

Remove '/' after ~/print. This should work

var w = window.open('http://example.com/print?id=42');

querystring should be followed by '?'.

Paritosh
  • 11,144
  • 5
  • 56
  • 74
  • This doesn't matter, I also tried "print.php?id=42". No effect. :( The string is always truncated after "?". – Daniel Jun 11 '13 at 11:51
  • try like this: window.open(url, windowName, "height=200,width=200"); as mentioned in [this post](http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab) – Paritosh Jun 11 '13 at 11:54
  • This topic is unrelated, because the problem isn't to open that window, the parameters get lost. – Daniel Jun 11 '13 at 13:13
  • I have the same problem and I didn't include that final `/`. The linked post seems talking about which target window to open , rather than the opener's missing query string. – Yan Yang Jul 26 '21 at 22:42