Click here to Skip to main content
16,018,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make call to a new webpage from my current webpage. Using which function is this possible ?
I want to keep the current page open and to add a new page alongwith previous page. So "header() " wont work over here.

Also i want to close a page automatically . Means the page should be closed automatically from web-browser . How is this thing possible in PHP ?
Posted

As far as I know PHP can't be used to open new tabs automatically. Instead I would recommend using JavaScript.
JavaScript
<script type="application/javascript">
window.onload = function()
{
    window.setTimeout(function() {
        window.open("http://www.google.com");
    }, 2000);
}
</script>

The "setTimeout" function executes after a given number of milliseconds, 2000 in this case.
Depending on the user's browser preferences the url will either be opened in a new window or in a new tab.
 
Share this answer
 
Comments
[no name] 3-Aug-12 5:06am    
Thanks , its working. Now Just need to customize it accordingly...
helmi77 3-Aug-12 7:42am    
I'm glad I could help
If you want to insert a web page in your current web page:

would include[^] fit your needs?

If you want to open a new page in a new window after clicking a link, probably the syntax used by CP would help you:
<a href="http://php.net/manual/en/function.include.php">include</a>[<a href="http://php.net/manual/en/function.include.php" target="_blank" title="New Window">^</a>]

PHP is server-side... I don't know if it can close your page but probably it won't...

Instead you could use javascript:
echo '<a href="javascript:window.close();">CLOSE WINDOW</a>'; 

Hope this helps.

PS: Google is your friend.
 
Share this answer
 
Comments
[no name] 3-Aug-12 4:49am    
i want to switch over to a new window without a click . I need Some automated way to call a new page.
[no name] 3-Aug-12 4:50am    
And thanks for js script. I will try it n let u know.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900