window.open

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lajos Kuljo

    window.open

    Hi,
    if I opened a php-page using

    ... onclick=\"help= window.open('he lp.php', 'Help',
    'innerHeight=40 0,innerWidth=40 0,screenX=555,s creenY=250,depe ndent=Yes,bar=Y es');
    ....

    is there a way to send data to the invoked page (help.php)? Something
    like $_POST[....] if I would use a HTML form-submit?
    Setting cookies or store data in mysql are not so very elegant solutions.

    Can somebody give me hint?

    Lajos
  • Henri

    #2
    Re: window.open

    Just add a query string after help.php:

    ... onclick=\"help= window.open('he lp.php?a=10&b=2 0&c=40', 'Help',

    'innerHeight=40 0,innerWidth=40 0,screenX=555,s creenY=250,depe ndent=Yes,bar=Y e
    s');
    ...

    Hope it helps
    Henri

    "Lajos Kuljo" <kuljo@freemail .hu> a écrit dans le message de
    news:o0xnd.1617 0$1p.14149@nntp server.swip.net ...[color=blue]
    > Hi,
    > if I opened a php-page using
    >
    > ... onclick=\"help= window.open('he lp.php', 'Help',
    >[/color]
    'innerHeight=40 0,innerWidth=40 0,screenX=555,s creenY=250,depe ndent=Yes,bar=Y e
    s');[color=blue]
    > ...
    >
    > is there a way to send data to the invoked page (help.php)? Something
    > like $_POST[....] if I would use a HTML form-submit?
    > Setting cookies or store data in mysql are not so very elegant solutions.
    >
    > Can somebody give me hint?
    >
    > Lajos
    >[/color]



    Comment

    • Grant Wagner

      #3
      Re: window.open

      Lajos Kuljo wrote:
      [color=blue]
      > Hi,
      > if I opened a php-page using
      >
      > ... onclick=\"help= window.open('he lp.php', 'Help',
      > 'innerHeight=40 0,innerWidth=40 0,screenX=555,s creenY=250,depe ndent=Yes,bar=Y es');
      > ...
      >
      > is there a way to send data to the invoked page (help.php)? Something
      > like $_POST[....] if I would use a HTML form-submit?
      > Setting cookies or store data in mysql are not so very elegant solutions.
      >
      > Can somebody give me hint?
      >
      > Lajos[/color]

      window.open(... ) is a GET operation, you can not POST data to the page being opened.
      However, you can pass approximately 2Kb of data on the URL itself during the GET
      operation:

      window.open(
      'help.php?a=' + clientSideVaria ble,
      'Help',
      '...attributes. ..'
      );

      If you actually want to POST data, you're going to have to store it in a form and
      POST that form:

      <form name="myHiddenF orm" method="POST" action="help.ph p" target="Help">
      <input type="hidden" name="myHiddenV alue" value="">
      </form>
      <a href="noJS.html "
      onclick="submit Form('myHiddenF orm');return false;">Help</a>
      <script type="text/javascript">
      function submitForm(name ) {
      var f = document.forms[name];
      if (f) {
      window.newWindo wHtml = [
      '<html>',
      '<head>',
      '<title></title>',
      '</head>',
      '<body onload="',
      'var w;',
      'if ((w = window.opener) &&',
      '(w = w.document) &&',
      '(w = w.forms) &&',
      '(w = w[\'' + name + '\'])) {',
      'w.submit();',
      '}',
      'window.focus() ;',
      '">',
      '</body>',
      '</html>'
      ].join('\n');
      window.open(
      'javascript:ope ner.newWindowHt ml',
      f.target,
      '...attributes. ..'
      );
      }
      }
      </script>

      --
      Grant Wagner <gwagner@agrico reunited.com>
      comp.lang.javas cript FAQ - http://jibbering.com/faq

      Comment

      Working...