473,729 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close browser/window

What I currently have is a page that opens another browser at 800x600, once
that is loaded I would like to close the orginal page down while keeping the
page that it has just opened open (To make it more clear take a look at
http://www.ithorizon.co.uk).

I have inserted some code below to show what I currently have, but I don't
have the knowledge to amend it, can somone please help.
<SCRIPT LANGUAGE="JavaS cript">
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL , "preview", windowprops);
if (closetime) setTimeout("pre view.close();", closetime*1000) ;
}

function doPopup() {
url = "frame.html ";
width = 800; // width of window in pixels
height = 600; // height of window in pixels
delay = 3; // time in seconds before popup opens
timer = setTimeout("Sta rt(url, width, height)", delay*1000);
}
</script>
Many thanks,

Graham
http://www.ithorizon.co.uk
Jul 20 '05 #1
9 3237
Ivo
"Graham" <gr****@mr2oc.c o.uk_NOSPAM> wrote in message
news:40******** ************@ne ws.dial.pipex.c om...
What I currently have is a page that opens another browser at 800x600, once that is loaded I would like to close the orginal page down while keeping the page that it has just opened open (To make it more clear take a look at
http://www.ithorizon.co.uk).
Popups aren't a very popular subject in this newsgroup, and if one would
even manage to close the originating window (which it won't), that popup
would die a thousand painful deaths on as many computer screens.
The reason it won't is that if the parent window was not created by your
script, your script does not have the permission to silently bin it. If I
add the line

window.close()

as the last command in your function Start(), which is one way of doing it,
my IE browser generates this confirm box:
"A script on this page is trying to close the window.
Do you want to close this window?"
at which point also people who are not regular to this newsgroup will start
wondering why all this is necessary. Bottom-line: leave the window (or
windows) to the user, they know best how they want to navigate their way
through your site. If you think your site is special and users need
directions, give them, suggest that they close the opener - in plain text.
If you make clear the benefit of doing so, they will.
HTH
Ivo

I have inserted some code below to show what I currently have, but I don't
have the knowledge to amend it, can somone please help.
<SCRIPT LANGUAGE="JavaS cript">
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL , "preview", windowprops);
if (closetime) setTimeout("pre view.close();", closetime*1000) ;
}

function doPopup() {
url = "frame.html ";
width = 800; // width of window in pixels
height = 600; // height of window in pixels
delay = 3; // time in seconds before popup opens
timer = setTimeout("Sta rt(url, width, height)", delay*1000);
}
</script>
Many thanks,

Graham
http://www.ithorizon.co.uk

Jul 20 '05 #2
Thanks for getting back to me on this.

The reason I want to get rid of the index.html window once to other window
opens is becouse it serves no purpose being there. Would it be a better idea
to pop a bit of code on there that closes down the window after 10 seconds
of it being open?

I can't seem to find any code on that, would you be able to point me to a
site where I can download it?

Many thanks,

Graham.
"Ivo" <no@thank.you > wrote in message
news:40******** *************** @news.wanadoo.n l...
"Graham" <gr****@mr2oc.c o.uk_NOSPAM> wrote in message
news:40******** ************@ne ws.dial.pipex.c om...
What I currently have is a page that opens another browser at 800x600, once
that is loaded I would like to close the orginal page down while keeping

the
page that it has just opened open (To make it more clear take a look at
http://www.ithorizon.co.uk).


Popups aren't a very popular subject in this newsgroup, and if one would
even manage to close the originating window (which it won't), that popup
would die a thousand painful deaths on as many computer screens.
The reason it won't is that if the parent window was not created by your
script, your script does not have the permission to silently bin it. If I
add the line

window.close()

as the last command in your function Start(), which is one way of doing

it, my IE browser generates this confirm box:
"A script on this page is trying to close the window.
Do you want to close this window?"
at which point also people who are not regular to this newsgroup will start wondering why all this is necessary. Bottom-line: leave the window (or
windows) to the user, they know best how they want to navigate their way
through your site. If you think your site is special and users need
directions, give them, suggest that they close the opener - in plain text.
If you make clear the benefit of doing so, they will.
HTH
Ivo

I have inserted some code below to show what I currently have, but I don't have the knowledge to amend it, can somone please help.
<SCRIPT LANGUAGE="JavaS cript">
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL , "preview", windowprops);
if (closetime) setTimeout("pre view.close();", closetime*1000) ;
}

function doPopup() {
url = "frame.html ";
width = 800; // width of window in pixels
height = 600; // height of window in pixels
delay = 3; // time in seconds before popup opens
timer = setTimeout("Sta rt(url, width, height)", delay*1000);
}
</script>
Many thanks,

Graham
http://www.ithorizon.co.uk


Jul 20 '05 #3
Graham wrote: <40************ ********@news.d ial.pipex.com>
The reason I want to get rid of the index.html window once to other
window opens is becouse it serves no purpose being there.

<snip>

The window that the user used to navigate to index.html may not serve
you any purpose but it does serve a purpose for the user. It is, for
example, holding their browsing history, and they are going to want that
in order to get back to their google search page to find themselves the
next site on the list in the hope that it doesn't try to mess around
with their browser windows.

Richard.
Jul 20 '05 #4
I suppose this is the sort of answer I was expecting to get earlier on. I
want my site to look in a particular way, is that wrong? If the visiter
don't like it then I'm sure they can go else where. I just can't see the
point of having a window open if it has served its purpose in making the
other window open.

Graham.

"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message
news:c1******** ***********@new s.demon.co.uk.. .
Graham wrote: <40************ ********@news.d ial.pipex.com>
The reason I want to get rid of the index.html window once to other
window opens is becouse it serves no purpose being there.

<snip>

The window that the user used to navigate to index.html may not serve
you any purpose but it does serve a purpose for the user. It is, for
example, holding their browsing history, and they are going to want that
in order to get back to their google search page to find themselves the
next site on the list in the hope that it doesn't try to mess around
with their browser windows.

Richard.

Jul 20 '05 #5
Graham wrote:
I suppose this is the sort of answer I was expecting to get earlier on. I
want my site to look in a particular way, is that wrong? If the visiter
don't like it then I'm sure they can go else where. I just can't see the
point of having a window open if it has served its purpose in making the
other window open.

Read the FAQ with regards to top-posting.

There is lots to be said about doing research.

One thing you are failing to realize is that a lot of people (I
included) will never ever see your popup window. AOL's popup blocker is
very adept at killing them, as are my other browsers. Now, when I go to
your page I am going to see a blank window and thats it. So, thats how
you "want your site to look"?

And yes, I can close the browser anytime I want to - it has an X on it
just for that purpose.

Keeping my secrets to myself with regards to anything else - proud of me
Richard? <g>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #6
Ivo

"Graham" <gr****@mr2oc.c o.uk_NOSPAM> wrote in message
news:40******** ************@ne ws.dial.pipex.c om...
I suppose this is the sort of answer I was expecting to get earlier on. I
want my site to look in a particular way, is that wrong? If the visiter
don't like it then I'm sure they can go else where. I just can't see the
point of having a window open if it has served its purpose in making the
other window open.
That is not its purpose. Its purpose is to continue showing pages after the
user has seen what he wanted to see (or not).
It has tremendous in value in that it is sized to a particular dimension and
position on the screen that he thought best when he positioned it, it
contains a history list which is unique to that window. You need to turn the
question around, you really do: what purpose serves your popup window? Do
you realize that more than 50 % of users (wild guess, I think I 'm
conservative) have popup blocking software and won't have even a clue why
your site is only a blank page if it doesn't at least say in plain text that
its only "purpose" was to clone itself.
HTH
Ivo

Graham.

"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message
news:c1******** ***********@new s.demon.co.uk.. .
Graham wrote: <40************ ********@news.d ial.pipex.com>
The reason I want to get rid of the index.html window once to other
window opens is becouse it serves no purpose being there.

<snip>

The window that the user used to navigate to index.html may not serve
you any purpose but it does serve a purpose for the user. It is, for
example, holding their browsing history, and they are going to want that
in order to get back to their google search page to find themselves the
next site on the list in the hope that it doesn't try to mess around
with their browser windows.

Richard.


Jul 20 '05 #7
Graham wrote:
I suppose this is the sort of answer I was expecting to
get earlier on. I want my site to look in a particular way,
is that wrong?
Inside the browser's viewport it is not wrong. It is probably
unrealistic to actually expect it as "look" is not entirely under the
control of the author. But whatever happens outside of the web page
displaying part of the current browser instance is not really the
business of the page author, that is up to the user.
If the visiter don't like it then I'm
sure they can go else where.
Most web sites want visitors they don't serve much purpose themselves
without them.
I just can't see the point of having a
window open if it has served its
purpose in making the other window open.


You see the window as a vehicle for opening a new window, the user sees
it as a piece of software that they opened and are using. Shutting it
down without their consent is no different from someone walking up to
your computer when you are 3/4 of the way through some complex task and
pressing the power button. You don't know what you would be destroying
with your proposed action so you cannot assess its value to the user.

Richard.
Jul 20 '05 #8
Randy Webb wrote:
<snip>
Keeping my secrets to myself with regards to anything
else - proud of me Richard? <g>


LOL. Yes.

Well I wasn't going to tell ;-)

Richard.
Jul 20 '05 #9
"Graham" <gr****@mr2oc.c o.uk_NOSPAM> writes:
I suppose this is the sort of answer I was expecting to get earlier on. I
want my site to look in a particular way, is that wrong?
The goal is not wrong (only misguided). The means are wrong. Changing
the browser's size or position is overstepping the limit of
hospitality. It will irritate the user. Often so will opening new
windows. Trying to close the current window is pretty darn rude,
destructive and bordering on unforgivable.
If the visiter don't like it then I'm sure they can go else where.
Except back, because you killed their browser window and its history.
Don't do that. It's not your window to close (even if you manage to
find a way to do it).
I just can't see the point of having a window open if it has served
its purpose in making the other window open.


I think Richard Cornford was pretty clear: It *does* serve a purpose
for the user. It holds his history, which is worth more to him than
your site.

/L 'and please don't top post'
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #10

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

Similar topics

9
3646
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
2
9319
by: Simon Fletcher | last post by:
Hello there, I need a "Close Window" script ( onLoad.Close.Window() ), however i need the script so it don't come up with this annoying window: "This window is trying to close" window. Is there a script to stop this happening and close the window anyway? Simon Fletcher
6
8536
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This all works fine. If the user selects "Open" or "Cancel", the window closes, which is the desired behavior. If they select "Save", the location dialog shows up, they save the file and the window remains open. I've tried a number of things to get...
3
3753
by: Isabel | last post by:
How can you close all child browser windows that where open by a parent browser window? I have links on a parent (main) page that opens the child page as a separate browser. However, I need to be able to close all the opened child browser pages from the parent page. Thank you for your help, Isabel
4
6322
by: Ron Lautmann | last post by:
I want to close a browser window so I created a Close button that does this: private void Button1_Click(object sender, System.EventArgs e) { RegisterClientScriptBlock("GetData","<Script>close()</Script>"); } But when this runs the browser puts up a dialog box saying: "The web page you are viewing is trying to close the window, od you want to close this window?"
7
3044
by: Paul | last post by:
Hi I have a web application that has a log off selection, just redirects the browser to a form with a label displaying you are loging off. In part of the application I open a new window and was wondering if there is a way to close all windows associated with the web application when the user selects the log off selection? Thanks. -- Paul G Software engineer.
37
6346
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window, without getting a alert message that ask if u want to close the window. This did NOT happen in Internet Explorer 6, Mozilla firefox or other browsers.
7
5827
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed to be two techniques for earlier versions. But the window.opener='' ;window.close(); and the window.open('','_parent','') ;window.close(); techniques do not work for me. I.e., I still get confirmation message
5
34366
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this helps to recognise whether the close button is clicked( also differentiates whethet refresh was clicked). The problem arises whenever i try to close the window by resizing it or by right clicking at the bottom of the page and then closing it. Can...
0
8763
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9202
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.