By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,046 Members | 2,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,046 IT Pros & Developers. It's quick & easy.

Open new window using javascript with php

P: n/a
I have to open new window without clicking link or url.. i need to
open autometically when entered the inside of my webpage. can any one
help this task..
Aug 14 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Aug 14, 12:18*am, Arivu PHP <arivusudar...@gmail.comwrote:
I have to open new window without clicking link or url.. i need to
open autometically when entered the inside of my webpage. can any one
help this task..
<?php

$url = 'http://someplace.com/someresource.html';

echo "<script>window.location=$url;<script>";

?>

or Only by using php

<?php

$url = 'http://someplace.com/someresource.html';

header("Location: $url");

?>

Thanks!!!
Raashid bhatt
2008
Aug 14 '08 #2

P: n/a
On Aug 14, 12:23*am, raashid bhatt <raashid_...@yahoo.comwrote:
On Aug 14, 12:18*am, Arivu PHP <arivusudar...@gmail.comwrote:
I have to open new window without clicking link or url.. i need to
open autometically when entered the inside of my webpage. can any one
help this task..

<?php

$url = 'http://someplace.com/someresource.html';

echo "<script>window.location=$url;<script>";

?>

or Only by using php

<?php

$url = 'http://someplace.com/someresource.html';

header("Location: $url");

?>

Thanks!!!
Raashid bhatt
2008
if u want to open new window
<?php

$url = 'http://someplace.com/someresource.html';
$str =
"<script>
window.open($url,'New window');</script>";

echo $str;

?>
Aug 14 '08 #3

P: n/a
raashid bhatt wrote:
$url = 'http://someplace.com/someresource.html';
echo "<script>window.location=$url;<script>";
results in wrong js-code! JS also requires string literals enclosed by
Single- or Doublequotes.

So long, Ulf
Aug 14 '08 #4

P: n/a
Arivu PHP wrote:
I have to open new window without clicking link or url.. i need to
open autometically when entered the inside of my webpage. can any one
help this task..
Whether the javascript is created by PHP or just in the file is immaterial.

Try comp.lang.javascript for the javascript code. Then just place it in
the file. No PHP required.

Just beware that it won't work for people who have disabled javascript.
It also won't work for those with popup blockers installed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 14 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.