Reputation: 2617
I would like to create a php file (lets call it master.php) that executes automaticlly a series of scripts in a new tab. Every script listed should be executed in a different tab. I tried using header(location), however it can only be used to redirect once. Any idea?
Upvotes: 1
Views: 1901
Reputation: 1468
I would suggest using Javascript to execute the scripts in different tab. However this open new windows and popup option has to be disabled. New tabs are not opened unless user explicitly clicks on an anchor element. The following code is an example from withing a PHP for loop.
window.open("script" + <?php echo
$i ;?>
+ ".php", '_blank');
Upvotes: 0
Reputation: 3950
You can create a hyperlink as below:
<body onload="document.getElementById('runScripts').click()">
<a id="runScripts" href="script1.php" target="_blank" onclick="window.open('script2.php');window.open('script3.php')">Click Here</a>
Upvotes: 0
Reputation: 2061
If master.php returns the first page, and then you could use javascript to open the other pages. Please note that this does not have 100% browser support.
<html>
<head>
<script type="text/javascript">
window.open('page2.php','_newtab1');
window.open('page3.php','_newtab2');
window.open('page4.php','_newtab3');
window.open('page5.php','_newtab4');
</script>
</head>
<body>content of first page</body>
</html>
You could also use '_blank' instead of ''newtab'
Upvotes: 0
Reputation: 2820
What you want goes beyond the scope of php. You have to use javascript to control the logic among the browser's tabs you want to launch.
From php, you should generate the proper javascript code to do that, in particular take a look at the javascript function window.open
Upvotes: 1