JavaScript - Closing A Window Using Javascript In Firefox
Hello all,
I am trying to close a window when I press a link using javascript. The code is simple... Code: <a href="" onclick="window.close()">Close this window</a> This works as well, and I know that it will work only on windows opened by javascript. That's ok as well. My question is that in Firefox, I can open a link a new tab. So I open a new tab by clicking on a link like this... Code: <a href="somepage.html" target="_blank">OPEN</a> Now when I try to close this tab using javascript, after closing it refreshes the page. This I know is happening because, I did href="". What's the workaround for this problem.... Similar Tutorialshello everybody i need your help and experience for having code to show ( overlay / modal window ) to the user when closing or navigating away from the page ( i want put in this window facebook share to make the user to share the page in his facebook ) , bytheway i wanna use it in my wordpress in every post could it be happen ? Thanks for helping Say you have a document with 2 frames with 2 buttons in one of the frames. If one button opens a window, how can you make the other button close it?
Hi, im thinking about something like this, is this the correct way to do this. Code: function run_timout() { timout = setTimeout(closethewindow, 3000); } function closethewindow() { alert("Your time is up!"); window.close('mywindow'); } Hi, I'm having troube closing the main Internet Explorer window using a script called from a right click menu. The code I'm using is: Code: <script language="JavaScript"> var oWindow = window.external.menuArguments; oWindow.close(); </script> When the script calls, windows prompts to close the window, but when 'yes' is clicked the Alert sound sounds and the window remains open! If the script is called from a button on the page it will close, but I want to close any page on the internet using a right click! All help will be gratefully received. Dave. Hi, I have an input element (textbox) on a webpage, and capture the onblur event of the input (textbox) control to do validation. My problem is that when the page is closed or the user click on another window the onblur event of my textbox gets called too. I need the onblur event handler to be called only when the textbox loses focus b/c another element on the SAME webpage gets focus, but not when the user clicks on another window or closes the browser window. What is the right way to accomplish this? Thanks in advance, Richard i have this code i need to close the parent.html window when the child window opened, i need the code for that working well in IE and Firefox Parent.html <HTML> <SCRIPT TYPE="text/javascript"> function sendTo() { window.open('child.html','_blank','resizable=yes,width='+(screen.width-500)+',height='+(screen.height-500)+''); } </SCRIPT> <BODY > <form name="form"> <input type="text" value="" name="text1" id="pdetails1"> <input type="text" value="" name="text1" id="pdetails2"> </br> <input type="submit" value="submit" onClick="sendTo()"> </BODY> </HTML> child.html <html> <body> <form> <input type=text name="text5" value=""> <input type=submit name="submit"value="submit"> </form> </body> </html> Hi! I'm working on a website where I need some help with open and closing divs using javascript. This is the website: clashjeans.se/test/styles.html As you can see I'm using a javascript to open each jeans style link, I don't know if this is the best way to do it, but it's how I've done it so far. If you click the "Frankie style link" at the bottom the div called Frankie will show and you will see a little image in that div that says "next wash". What I would like this link to do is to close the frankie div and open up another wich looks almost the same as the previous, the only thing that will change is the pictures actually. Please help me solve this problem, any suggestion about how to make this work will be highly appreciated! Hi All, I have to know whether we can track the direct browser closing event by Javascript. I have tried with window.unload & window.onbeforeunload, but I was not get full satisfaction with those ones. Please let me know if anybody have any kind of solutions other than those specified above. advance thanks... Here is the program: http://www.1728.com/newwindow.htm Basically, I want to input a number in the input box, which assigns a number to the variable numval located at document.box1.b1. When clicking on the "new window" button, an alert displays the input box value, then another window opens and displays the integers 1 through 12 and the amount squared. I would like the new window to obtain the number from the previous window so that the new window will display integers (and their squares) from 1 to the value of numval. I have a form that lets users click on date time value that is a link. When the link is clicked, a pop up opens up allowing the user to change the date and time. When they submit the date/time change form, the pop up is supposed to close and the date/time i the original form should be updated. This works in IE, but not FireFox. Inital form code: Code: function openTimeWin(windowURL, windowname) { var strHelpOptions = 'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=320,height=230'; mywindow = window.open(windowURL, windowname,strHelpOptions); mywindow.moveTo(5,5); mywindow.focus(); } Code: <A HREF="javascript:openTimeWin('CallLoggerTime.cfm?SCDate=#URLEncodedFormat(DateFormat(StartCall,'mm/dd/yyyy'))#&ECDate=#URLEncodedFormat(DateFormat(EndDefault,'mm/dd/yyyy'))#&SCTime=#URLEncodedFormat(TimeFormat(StartCall,'h:mm:ss tt'))#&ECTime=#URLEncodedFormat(TimeFormat(EndDefault,'h:mm:ss tt'))#','TimeWin')">#TimeFormat(StartCall,"h:mm:ss tt")#</a> Pop up window relevant code: Code: <script language="Javascript"> opener.ThisForm.StartCall.value = "#newStart#"; opener.ThisForm.EndCall.value = "#newEnd#"; opener.catchdummy.prematureflag.value=0; opener.ThisForm.submit(); self.close(); </script> Anyone know what's up? Thanks! Been trying for three days to find a way to self close a FF window. The window is opened from a link on a board, and its only purpose is to run an onLoad script that launches a popup window, after which I need it to close itself. There are any number of ways to do this in IE, but nothing works in FF - the parent window remains open. Seems ridiculous that something so simple can't be done. Any help would be appreciated. Thx. Hi Guys, I have written a simple code to open up a new window onclick of a button as follows; Code: function loadExamp() { var reqType = getElementValue("reqType", 1); window.open("../jsp/loadExamples.jsp?reqType=" + reqType, "Connection Test Utility - Message Examples", "width=500,height=300,menubar=no,status=yes, location=yes,toolbar=no,scrollbars=yes" ); return; } The problem is that this code is working on Google Chrome but not in Firefox and IE. Why is that and how can I resolve this issue. I am using Firefox 3.6.11 and IE 8.0.XX. Also I tried to open a new window using <a href> option with the same URL and its working but the only problem is that I want to pass my next JSP an argument which is only possible with function or script. I googled it but couldn't find much information except that there is some security problem. For that I have disabled the 'Pop up Bloker' on both Firefox and IE but still not working. When I click my button there is no activity with 'Firefox' but IE gives me error as follows; Code: Message: Invalid argument. Line: 74 Char: 2 Code: 0 URI: http://localhost:8080/T24Utility/scripts/verifyCxPool.js Please help, Thanks, -- Sjunejo Hi I wrote following code for the purpose to single right click to open new window, while left click would open another window. It works for IE but does not work for Firefox. Please help. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US|zh-Hans|zh-Hant"> <head> <title>Javascript Question</title> <META NAME="LANGUAGE" CONTENT="en"> <META NAME="DOCUMENTCOUNTRYCODE" CONTENT="us"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=GB18030"> <script language='Javascript' type='text/javascript'> var rightClick = false; window.document.oncontextmenu = new Function("return false"); window.document.onmouseup = mouseUp; function mouseUp(e) { if (!e) var e = window.event; if (e.which) rightClick = (e.which == 3) else if (e.button) rightClick = (e.button == 2); if (rightClick) window.open('http://www.yahoo.com/'); } </script> </head> <body> <a href="#" onclick="window.open('http://www.google.com/')" onmouseup>Open New Window</a> </body> </html> Hi, Can you please help me to solve the window.open() problem with firefox browser? I wrote the statement which is given below, window.open('filename.php','file_head','width=730,height=525,status=no,location=no,menubar=no,resiza ble=no'); Only width & height parameters were working in firefox & others are not working. This was working properly in IE. Problem exisitng with firefox only. Please let me know if anyone have solution for this problem Hi, I know this isn't in the context of the rest of the code but hoepfully it's enough to go on. Is anyone able to tell me why the following works in FireFox but not IE - Code: var DateTextBox; function WindowPostBack(newdate) { window.DatetextBox.SetDate(newDate); } and the following works in IE but not FireFox - Code: var DateTextBox; function WindowPostBack(newdate) { window[DatetextBox.id].SetDate(newDate); } FireFox doesn't recognise 'id', IE seems to require it. I need it to be supported in both so I've put in a check to see which browser the code is currently dealing with and used both snippets in an if/else but it seems to me that something so straightforward shouldn't require this and I am missing something obvious. Hopefully some wiser heads than mine can help me out with this. Many thanks in advance for any responses... The photo html files on the Fanac Fan History project's website are setup to be displayed properly when JavaScript is disabled and reformatted by a php script when JavaScript is enabled. The reformatting adds some features and positions each photo's caption and credits based on the width of the photo and the browser's page width. This worked well except that, when a photo page was accessed the browser's back button wouldn't work properly. This was because I had failed to include the replace option in my windows.open statement. The statement now reads fileWindow = window.open(fileURL, "_self", "", true); and this has cured the problem with IE but it still doesn't work with FireFox. Oddly enough it worked correctly with Google's Chrome with/without the replace and with Opera and Safari it also sort of worked without the replace. With replace Opera works correctly but Safari stll needs a double click. Any suggestions? I currently have my code set to this: Code: <a href=\"javascript:if(confirm('Are you sure this offer is not working and wish to report it?;?')){document,location.href='report.php?offername=".$row['name']."&offerid=".$row['offerid']."';}\">Report</a> How would I make it so that: 1. It opens in a new window (target="_blank")?? 2. I can define how big that window is Thanks hi. i am looking for help (example) to open to a new window in the original window. the original window is blocked from any user inputs. a good example is here at http://www.dominos.com/home/index.jsp and click on "locations" button. is there a special name for this window.open? thanks Hey Guys, I feel like a complete idiot posting this, but I clearly am missing something. I'm trying to open a window with the specs below but all it does is open a standard sized window. Any help would be greatly appreciated. Code: <SCRIPT LANGUAGE="javascript"> function open_window() { window.open ('https://domain.com/document.php','newwindow',config='height=418,width=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no') } </SCRIPT> <p><a onclick="open_window()"><img src="images/image.png" width="142" height="113" /></a></p> What i would like from someone if it can be done is when a page loads a another window will open with links to pages and then when a link is pressed the first window opens with the url of the link clicked but the navigater window still open so that the user can still use the navigator to navigate round the site and also if posible that there is 2 textbox one called title and the other called url and then a submit button and then it adds to the links in the page and is saved And philip M if you read this then if you havent already done so go to your private messages but i think that you have and your ignoring me so that fine if this post is in the wrong catorgry then please say with correct part of the forum.
|