473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

specifying a new window when using Location:

In some of my script ive been using the followin

if(isset($_POST['mybutton'])){
header("Location: http://www.mysite.co.uk/path/my.php");
}
This changes the page in the open browser window. How can I modify this to
open a new window without replacing the parent
Sep 26 '06 #1
4 1582
mantrid said the following on 26/09/2006 23:59:
In some of my script ive been using the followin

if(isset($_POST['mybutton'])){
header("Location: http://www.mysite.co.uk/path/my.php");
}
This changes the page in the open browser window. How can I modify this to
open a new window without replacing the parent
You can't. HTTP headers don't work that way.

The only way to achieve this behaviour is to include HTML/JavaScript
code which causes a new window to automatically appear. But note that
that's exactly what a pop-up is, and most browsers have pop-up blockers
nowadays, because people don't like them...
--
Oli
Sep 26 '06 #2

"mantrid" <ia********@virgin.netwrote in message
news:Dh*******************@newsfe7-gui.ntli.net...
In some of my script ive been using the followin

if(isset($_POST['mybutton'])){
header("Location: http://www.mysite.co.uk/path/my.php");
}
This changes the page in the open browser window. How can I modify this to
open a new window without replacing the parent

this works:

if(isset($_POST['mybutton'])){
echo <<<WIND
<script type="text/javascript">
window.open("http://www.mysite.co.uk/path/my.php");
</script>
WIND;
}

but as you can se also requires js
Sep 27 '06 #3
Thanks Johnny
That works but not if popups are blocked
So I was wondering if there is a way of testing if popup blocking is set and
if not run the first bit of code and if so run the second so at least the
user would get the page even if it is not on a separate window ie something
like;
if(isset($_POST['viewtest'])){ ?>

if popup blocking is not set then run the following

<script type="text/javascript">
window.open("http://www.mysite.co.uk/path/mypage.php");
</script>
<?php

else if popup blocking is set run the following

header("Location: http://www.mysite.co.uk/path/mypage.php");

}

"Johnny" <re*****************@hotmail.comwrote in message
news:OKmSg.406$UJ2.198@fed1read07...
>
"mantrid" <ia********@virgin.netwrote in message
news:Dh*******************@newsfe7-gui.ntli.net...
In some of my script ive been using the followin

if(isset($_POST['mybutton'])){
header("Location: http://www.mysite.co.uk/path/my.php");
}
This changes the page in the open browser window. How can I modify this
to
open a new window without replacing the parent
this works:

if(isset($_POST['mybutton'])){
echo <<<WIND
<script type="text/javascript">
window.open("http://www.mysite.co.uk/path/my.php");
</script>
WIND;
}

but as you can se also requires js


Sep 27 '06 #4
mantrid wrote:
Thanks Johnny
That works but not if popups are blocked
So I was wondering if there is a way of testing if popup blocking is set and
if not run the first bit of code and if so run the second so at least the
user would get the page even if it is not on a separate window ie something
like;
if(isset($_POST['viewtest'])){ ?>

if popup blocking is not set then run the following

<script type="text/javascript">
window.open("http://www.mysite.co.uk/path/mypage.php");
</script>
<?php

else if popup blocking is set run the following

header("Location: http://www.mysite.co.uk/path/mypage.php");

}

"Johnny" <re*****************@hotmail.comwrote in message
news:OKmSg.406$UJ2.198@fed1read07...
>"mantrid" <ia********@virgin.netwrote in message
news:Dh*******************@newsfe7-gui.ntli.net...
>>In some of my script ive been using the followin

if(isset($_POST['mybutton'])){
header("Location: http://www.mysite.co.uk/path/my.php");
}
This changes the page in the open browser window. How can I modify this
to
>>open a new window without replacing the parent

this works:

if(isset($_POST['mybutton'])){
echo <<<WIND
<script type="text/javascript">
window.open("http://www.mysite.co.uk/path/my.php");
</script>
WIND;
}

but as you can se also requires js


If there is a way, it is probably browser-dependent; and I'm not sure
there is.

But I would think that you could make the javascript try and create the
window with a name, and then check whether the named window exists. If
not, you can change 'location' in the Js.

Colin
Oct 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to...
3
by: sentinel | last post by:
Hi all, I'm trying to reload a frame from a pop-up, but really cannot figure this out. Within my index.htm file, I make a link to call a pop-up frame with a javascript function that calls the...
3
by: saiho.yuen | last post by:
Hi, Is anyone know what is the difference between Location.href and Window.location.href Thanks you very much:) Saiho
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
1
by: nospam | last post by:
All I am trying to achieve the following: Main window page's asp code writes the following line to launch a popup window (note the IFRAME has to be in the popup window, it cannot be in the...
4
by: Kenneth | last post by:
Hi, I have two forms, parentForm and childForm. parentForm has a button(btn1) and a grid. childForm has a couple of textboxes and a button. The button on parentForm opens a new window of...
1
by: Colin Graham | last post by:
Specifying location of web site using VS 2003 setup project. I have an issue trying to install my asp.net website to a specific location. I have several webistes in my IIS Manager and it keeps...
5
by: soni2926 | last post by:
Hi, I have a pop up window, that window needs to refresh the parent window when opened, I'm doing the following: window.opener.location.href(window.opener.location.href); problem I'm having...
4
by: asearle | last post by:
Hi Everyone, Does anyone know how I can dictate what size and location the browser window should have when opened? I have a lot of fixed-width columns and so it would be great if I could do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.