Im writing a small app that will basically be like a wiki for family memebers to go in and make pages using my wysiwyg editor, update pages, ect..
the problem i've run into is trying to ensure they have saved the page. I have a variable to detect whether or not unsaved changes exist. however the problem is now stopping the close event if the user clicks 'cancel' in the confirmation box.
Examples of when the 'navigation' or 'browser close' should be blocked: 1)i've made a small change on the page then clicked on a link, i should receive a conf message asking me if i want to loose changes. 2)i've made a change on the page then clicked the browser 'X' (close) button by accident. I should get the conf message here as well. 3) i've hit the refresh or reload button without saving. again i want the conf message.
Note, if they want to close, clicking OK should allow them too. furthermore, this function to block the close and produce the confirmation only will be called if there are unsaved changes on the page.
here is what i have so far - and this appears to work fine in IE. Code:
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 ?
I cannot write the small javascript, Before let me tell you, I am scriptkiddie in javascript and i dont have much knowledge of it. Here is my attempt, and i failed everytime.
Intention of Javascript code :- To Open link in new window, if clicked ok, else to open link in same tab.
<script type="text/javascript"> function show_confirm() { var awesome=confirm("Ok to Open Link in New tab, Cancel to open link in Same window!");
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.
I am developing a contact form and I have the form fully working but all I want is for when you fill out the contact form and submit it, a Lightbox window shows the confirmation page instead of it opening in the whole window. I have tried everything I can think of (I am a complete newbie with JS). The form is located here: [URL].
I am trying to use the window.setTimeout feature so that a message pop-up with yes/no appears on the screen asking whether to extend the session.*If yes is clicked, the current page reloads.*If no is clicked, nothing happens. (the session will expire anyway).
- 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.
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!!
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.
I have parent page with 10 child window and i want to close all child window when click on close session button on parent but first i need to check whether any child window open or not after that action should be done for close the child window.
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?
I want to close all child window with parent window. First i want to detect whether any child window open if open then it should be close after click close button on parent window.
I urgently need a piece of JS that will close the window when a user clicks a button. Using window.close works but it gives an alert box to ask the user if they want to close the window. Is there a way around this?
function closeAll() { if (myWin && myWin.open && !myWin.closed) { myWin.close(); } }
how do i work in antoher window in there "myOtherWin" so that when this function is called both windows are closed myWin and myOtherWin, regardless which or both are opened?
I have created a form. Within the form is a button to close the window on click and to validate as well. The close window works when it is a stand alone, but it does not work when it is embedded with the other code. Here is the code I am currently using:
I've a button that onclick calls a function that calls the following code. The last 3 lines are for IE, which didn't want to close till I put in the funny line with opener.
This closes a window in IE, but in FireFox an odd thing happens. I have to mouseout of something before it closes. If I click the button and then leave the mouse sitting there, above the button, then nothing happens in FireFox. It's as if the code is broken.
I did originally have window.blur in their, instead of parent.focus. But I took it out a while ago and did shift-refresh in FireFox.
I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window containing some text and an animated GIF. The javascript returns 'True' and the file is uploaded. All of that works great.
Problem: Now I am trying to close the child window after the file has been uploaded. Below is the JavaScript I'm using:
Observations: Error Msg: "progress is undefined". I have observed that after form submission the 'if' statement in the 'close child window' code fails because the handle 'progress' appears to have no value. My guess is that on form submission the handle 'progress' looses its' value because the action for the form is to reload itself. The 'if' staement does execute because I have placed an 'alert' statement just prior to it an the 'alert' executed appropriately.
If I try to open the window after submitting the form, the page doesn't open until after the file has been uploaded, which defeats the purpose.
Question: How do I close the window after the form has been submitted?
Thanks for your help! Irvin. ________________
Javascrtip Code: ________________
To open the child window: <script language="javascript"> var progress=null; function sendfile() { progress=window.open('test2.htm','progress','width =350,height=475'); return true; } </script>
To close the child window: This code follows my PHP code that verifies the file upload. <script type="text/javascript" language="javascript"> if (progress && !progress.closed) { progress.close(); } </script> ________________