How To Distinguish Between Page Refresh And Window Close?

Aug 28, 2006

I'm not sure if this question should go to the "JavaScript" section;
but I'm open to non-JavaScript (like VBScript) options too. So, I'm
posting this here.

I have the following problem:

For my application, I need to ask a confirmation when the user closes
the browser-window. If the answer is positive, I would like to log-off
the session and close the window. If the answer is negative, I would
like to stay back (no logging-off, no closing the window).

I can't do this in the window.unload event because the window is
already closed when the unload event is fired. I tried doing this in
the beforeUnload event. But the beforeUnload event gets called even
when I refresh the page and in that case, I don't want to ask this
question or logoff.

View 1 Replies


ADVERTISEMENT

Refresh DIV On Modal Window Close Event?

Nov 3, 2010

I am a visual designer that can usually install pre written code without to much difficulty. And, indeed I have installed FancyBox

I am working with a dynamically generated page written in ColdFusion. Three divs on the page contain FancyBox links that open editing screens. Once editing is complete and the user closes the FancyBox modal the changes need to be reflected on the parent page.

Right, so I was able to find a solution that refreshes the entire page

'onClosed': function() {
parent.location.reload(true); }
});

to refresh the entire parent page. But, that causes a browser prompt that is confusing to users and a bit of over kill as I really only need the information edited to refresh.

How, oh how can I get just a single div to refresh "onClosed" as apposed to the entire page?

View 1 Replies View Related

Close Popup And Refresh Parent Page

Nov 8, 2005

here's what i need to do:

1. open popup
2. on submit -- run the asp to process results and then
3. close the page
4. refresh the paretn page


how can I do this? can anyone help me?

View 2 Replies View Related

Distinguish Between Browser Close Event In Firefox Browser?

Apr 13, 2009

I have to open a new window when user closes the browser window. But the problem is that on browser close unload event calls and the same event is called with we refresh the page. So it is opening the popup window on both window close and window refresh.

View 1 Replies View Related

Close Window AND Go To New Page In Parent Window

Nov 2, 2004

I have a product that has many features. Clicking on a feature opens a popup window with explanation. There is a js Close Window link in each. All is fine so far.

Now in one popup window there is a reference to a different page of the main website. Is it possible to have a single text link both CLOSE the popup AND go to a new page in the parent window?

View 3 Replies View Related

Using Close Window Buttons On A Refreshed Page

Nov 1, 2005

I'm new to javascript and im trying to add a close button function to my certain pages of my site. I use this code:

<a href='javascript:window.close();'>Close Window</a>

to create a hyperlink which closes the window. However with pages which
display data retrieved from a database using PHP i use a form to submit
a search on the page which displays results. At the bottom of the page
is the close window link, however it fails to work once a form has been
submitted on the page. It only works when the page first loads.

Any ideas guys on how i can get a close window option that works on my
results page after submitting a search?

View 3 Replies View Related

Refreshing To A New Page Via Popup Window Close

Dec 8, 2005

I was curious if such a thing is possible, I've seen it done before, but not exactly sure how that would work. Would it have something to do with the window.close (); function?

View 7 Replies View Related

Pop Up Window Will Not Obey A Close Command From Original Page.

Jul 20, 2005

I am trying to create a new window from which the original page can close that new window. For some reason the following code will not work. Passing the window.open command to a variable called myWindow does not work with the mouse event, but it seems to work fine with a javascript: URL command. I would prefer to do it with the mouse event. Code:

View 2 Replies View Related

Automatically Close The Window When The Focus Is Lost From The Page

Jan 11, 2011

Ok so I have a site that I want to automatically close the window when the focus is lost from the page. For example, if the user clicks off the page to something else on there desktop I want the page to close. So far I have managed to do this but the grids on my page and the scroll bars all trigger the close function when clicked on. Is there anyway to make the scroll bars and drop down boxes not trigger the function?

This is the line of code that I have.

Code:

View 4 Replies View Related

User Can Close The Browser Or To Open The Window Browser Without Or With A Disable Close Window Button?

Apr 5, 2009

I need to know if the user close the browser or to open the window � browser without or with a disable close window button How can I???

View 6 Replies View Related

Trap The Window.close() Event When The User Clicks On The Close Button Of The Browser

Jul 20, 2005

I want to trap the window.close() event when the user clicks on the close button of the browser using javascript. Can anyone shed light on this problem ?

View 1 Replies View Related

Refreshing Page - Refresh The Parent Window Doesn't Work In IE8?

May 9, 2011

why my simple javascript to refresh the parent window doesn't work in IE8? When the child window closed, it reopen another new window for the page I want the parent window to refresh and nothing happened on the parent window.How can I make it load the page from parent window instead of a new window ??? it works perfectly in other browsers but not IE.

Code:
<script language="JavaScript">
<!--
function rent() {[code].....

View 1 Replies View Related

Open A Window With A Variable - Refresh Page On Submit Data

Sep 30, 2010

I want to be able to open a window with a variable. For example, I will use domain.com?reference=1234- This link will open a pop up window as follows:

<a href="javascript:popUp('http://www.domain.co.uk/staff/tpr/update_action_log.php?action_reference=<?php echo $row2['action_reference']; ?>')" title="Click Here edit this entry"><?php echo $row2['action_reference']; ?></a>

When I open this window, it is always showing data put in last, it isnt refreshed. I wanted to open this pop up window, enter data and then click submit and make the data enter the database and then refresh the parent window. Every time I have done this, either the parent or the pop (or both) is showing old data.

View 9 Replies View Related

JQuery :: .ajax And Page Refresh In Firefox - Can't Send Form Data In FF Without Page Refresh

Apr 15, 2010

So my problem is that i can't send form data in FF without page refresh (though in IE7-8 everything works smoothly).

My code fragments:

View 1 Replies View Related

Child Window Close Event - Opening Another Link In A Separate Window Using Window.open()

Jan 29, 2010

I have a HTML and I am opening another link in a separate window using window.open() . The child window is something like 'http://yahoo.com' which is out side html. I need to refresh the parent window when the child window is closed.

View 4 Replies View Related

"window.close()" Won't Close My Popup Window In Most Browsers

Apr 7, 2010

- I have a button on my Flash site that opens an HTML page in a popup window. In Flash, I open the new window using Actiosnscript 2.0:

- Within the popup window are links to other HTML pages. They all open in the same window. I've been using the following to create the links in Dreamweaver:

- On each page, I have a "Return to Main Menu" button that should close the popup window. To do this, I have been using:

- The problem is that it works differently in each browser, and I can't even get it to consistently close the window in most browsers:

Internet Explorer = popup message appears, asking "Are you sure you want to close this window?" or something similar; window closes after clicking "Yes."

Safari = Only closes if I'm on the original HTML page. If I click on any of the other links (note that these all open in the same window), those pages' "Return to Main Menu" buttons cease to work. However, if I keep clicking "Back" until I get to the original page, it closes.

Opera = Button actually works for each page.

Firefox & Chrome = Does not close the window at all.

I looked into it and saw that others have used a window.opener to solve similar issues. But, since my popup window is opened using Flash/AS2, I need to find a way around it.

I've tried preceding "window.close()" with "window.opener=null" (i.e. -onClick="window.opener=null; window.close()"), but I don't think I'm doing it right because it still doesn't work.

I've also seen others use codes that involve functions and variables, but it is beyond my current coding knowledge to implement this. Like I said, I'm sort of new at this.

View 5 Replies View Related

Remote Refresh Main Then Close

Jul 20, 2005

I've got a situation where I'm updating a MySQL DB with PHP but because of
how the language works I need to do the following.

The "main page" will open a remote page where the user will add/edit/modify
data then on the confirmation page, there needs to be a close button.
However, before the window is closed, I want it to reload the "main window"
so that they can see the changes they made. I've been digging through the
google groups and JS sources on the net but I'm just not finding answers for
a JS newb like myself.....

View 1 Replies View Related

How To Detect Browser Refresh Or Close

Jul 16, 2010

In my application I want user to take an "Exit Survey"(Independent website) when he is leaving the application. As name explains, It should happen only when user closes current browser tab or browser window.Its possible using JavaScript OnUnload event. But the problem is that this event occurs on

1. close of browser tab
2. close of browser window
3. click of any internal page link(i.e anchors and form buttons)

[code]....

View 2 Replies View Related

Identifying Between Refresh And Close Browser Actions

Jul 23, 2005

When we refresh the page (F5, or icon in browser), it will first
trigger ONUNLOAD event and then trigger
ONLOAD event. When we close the browser (X on right top icon), it will
trigger ONUNLOAD event.

Now when ONUNLOAD event is triggered, there is no way to distinguish
between
refresh the page or close the browser.

Here's the code fragment. The logic in window_unload() only applies to
closing the browser, not refreshing the page.

<BODY ONUNLOAD="window_unload()">
function window_unload()
{//logic that only applies to close the browser, not refresh the page.
}

Anyone knows the workaround to the problem?

View 1 Replies View Related

Refresh Div Area In Parent When Close Child?

Jul 14, 2010

I have a parent page that when load populate a div area from database.

I want when I click and open a child page, do some selections(for example check some checkboxes) and press submit, the child will close and the div area in parent will refresh .

View 2 Replies View Related

Creating Popup Windows - Add A "Close Window" Button On Survey.html Page

Mar 13, 2010

I read about window object and specifically about creating popup windows. The code below produces a popup window when a link is clicked:

Code JavaScript:
var Survey =
{
init: function()
{
var surveyLink = document.getElementById("survey");
Core.addEventListener(surveyLink, "click", Survey.clickListener);
},
[Code]....

I would like to add a "Close Window" button on survey.html page and when that button is clicked, the window would close. How do I do that? I know that I should use (reference to popup window).close(), but how and where do I attach even listener to that button?

View 1 Replies View Related

JQuery :: Using "window.location" For Link But Back Button Does Not Refresh Initial Page?

Nov 1, 2011

Here is the url:The issue, as you will see, is initially when my front page loads the "menu" animates into place. Then after a button is clicked:

$(".home_button").click(function() {
$('#content_menu').stop().fadeOut(1000,function() {
window.location = "http://jquery.com/";

[code]...

That all works fine. The issue is when I use the back button on the browser to return to the home page the animation never triggers and the page remains unusable until a refresh. How can I have this page refresh when the user uses the back button and/or is there a better way to do what I'm asking?

View 1 Replies View Related

Script To Close Old Window And Open New Window With New Link And Specific Size

Jan 29, 2006

I need a script that will open a new window (popup / new link) in a specific size, but will also close the old window (where the popup came from). I know the popup window is easy but finding a work-able close window script as the new window is opened is impossible!!

View 3 Replies View Related

Capture Child Window Close Event In Parent Window?

Feb 1, 2010

I have an HTML page where I am opening a child window using window.open. the child window is something like yahoo.com. I want to refresh the parent window when the child window is closed.

View 1 Replies View Related

Close Child Window When Parent Window Closes?

May 3, 2009

I'm trying to create code to close the child window I'm creating if the parent window is closed. Here's my code so far:

function openWindow() {
var newWin = window.open(); // open the new window
newWin.document.write('<h1>Child Window</h1>

[Code]...

The above openWindow function is used in this event: <input type="button" name="btn" onclick="openWindow()"value="Open a new window" />

I can generate the new window fine. I just can't close it if the parent window is closed.

View 1 Replies View Related

JQuery :: Refresh DIV With Full Page Refresh?

Aug 11, 2009

How to refresh DIV , without refresh entire page,Am having four DIV ,

DIV1,DIV2,DIV3,DIV4

I want to refresh only DIV! without affecting the DIV3,DIV4 ,

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved