How to open multiple browser windows on request? (

2019-07-19 05:28发布

So I have a form on PHP/HTML page. User submitss it to that same PHP/HTML page. So now PHP page I will have $_POST data. I want to when page is refreshed opnt some popUp browser windows which url's will be relative to users POST request. like www.example.com/bal-bla-bla.php? id=$_POST['StreamId']

3条回答
贪生不怕死
2楼-- · 2019-07-19 05:42
if ( isset($_POST['submit']) ) {

echo '<script>window.open ("'.$_SERVER['PHP_SELF'].'myplayer.php?stream_id='.$_POST['StreamId'].'","myplayer");</script>';

}

edited:

you can always display a message before open the window that advice the user to accept this new window!

var flag = confirm(" This window is not an ADV! ;-) ");
if (flag)
window.open("'.$_SERVER['PHP_SELF'].'","myplayer");
查看更多
唯我独甜
3楼-- · 2019-07-19 05:46

Include some <script> elements with window.open calls in them in the response … then watch as every popup blocker in the world blocks them.

查看更多
贪生不怕死
4楼-- · 2019-07-19 05:49

You would need to do this client side in javascript.

You could use window.open() in a document.onload event handler.

However, chances are if the user has a pop-up blocker this will be blocked.

查看更多
登录 后发表回答