开发者

How to open multiple browser windows on request? (PHP)

开发者 https://www.devze.com 2022-12-28 16:39 出处:网络
So I have a form on PHP/HTML page. User submitss it to that same 开发者_StackOverflowPHP/HTML page. So now PHP page I will have $_POST data. I want to when page is refreshed opnt some popUp browser wi

So I have a form on PHP/HTML page. User submitss it to that same 开发者_StackOverflowPHP/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']


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


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");


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号