javascript - Reopened pop window on browser reload: -
openerwindow.php
call openedwindow.html
through button , why when close openedwindow.html
, refresh browser openedwindow
shown again?? isn't popup window triggered through button. can't figure out, why , how solve :
openerwindow.php
<!doctype html> <html> <head> <meta charset="utf-8"> <title>document</title> </head> <body> <form method="post" action=""> <input type="submit" name="open" value="open pop up" onclick=""/> <?php if(isset($_post["open"])){ // if button clicked call other html page pop ?> <script > newwindow = window.open('openedwindow.html', 'formuntukupte', 'width=400,height=350'); </script> <?php } ?> </form> </body> </html>
openedwindow.html
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> </head> <body> </body> </html>
i appreciate ,,
when refresh browser preserving post data.
you can check adding <?php print_r($_post); ?>
to page , see if post data still there.
it seems easier in javascript:
<button onclick="window.open('openedwindow.html', 'formuntukupte', 'width=400,height=350')">open popup</button>
if need in php need store value in session var, like:
<?php session_start(); if (isset($_post['open'] && !isset($_session['popup_shown'])) { $_session['popup_shown'] = true; ?> <script> //popup launch </script> <?php } ?>
Comments
Post a Comment