JavaScript - Open Multiple Browser Tabs With Javascript And Then Close Them With Javascript
Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once.
Does anyone know how to do this please? Thanks so much for your help. Similar TutorialsHello guys, im working on another little project for my team here, and the way our system works is in order to change a persons password, there is a certain link that has to be accessed...for example...if i want to change a persons password, lets say UserID: t-test100 current pass: 911 and i want to change the password to 999 instead of 911...there is a link that needs to sorta load the profile in the background first in order to do the password change, i got the password change page down to a T and it works like a charm, but ONLY when the link is accessed, so for example, this is how the link would look like https://www.***.com/Sps/jsp/MyChange...?uid=t-test100 as soon as that URL is accessed, my code that i made for the password reset, works, but if i open a fresh window (where no cookies have been logged) and i go directly to my page where i have the script to change the password, it will come back with an error, but when i go to that URL and then back to my script and run it again, it works fine....SOOOO...back to my question...how would i be able to make it so that i have an extra link on my site that i can add to go to https://www.***.com/Sps/jsp/MyChange...?uid=t-test100 URL in a new window...but i want it so that when i click the link, it opens up the URL and closes the window after 1 second...or less...just so that it loads the URL in the background and thats it basically what i need to do, just for it to open for a split second, for the browser to register that i've visited the URL for that particular username, and then so that when i try to change the password, it goes through. Hi... Is there anyway to differentiate between refreshing a window and closing the browser. It seems both events are handled by onUnload event. Thanks I am currently designing a website for our public library. I have added a card catalog search bar on the side of every page. Our catalog software company has supplied the code. After embedding it, I previewed each page to make sure it was working properly. At the time, it worked fine. Since then, I have added other elements to the homepage such as a Twitter feed and a Flickr slideshow. Now, when I attempt to search in the catalog search bar on the homepage, it opens two tabs, but only in Firefox. Our IT person from the software company suggested I make a copy of the page and strip the code down to see what the problem is. After doing this, I have made no headway. Even with the catalog as the only code left on the page, other than text, it still opens two tabs. The following is the code embedded on the homepage: Code: <div> <script type='text/javascript'> function gotoserver() { sn = document.getElementById('server').value; redirecturl = 'http://webopac.infovisionsoftware.com/stephenville/default.aspx?Title='+sn; window.open(redirecturl) //document.location.href=redirecturl; } </script> <input type='text' name='server' id='server' /> <input type='submit' id='mySearch' value='Go' onclick='javascript:gotoserver();' /> </div> I would appreciate any advice given. Thank you for your time. Hi! I need to open a window when: 1 user leaves the site 2 when the browser is closed. I tried the 'unLoad' event but it works only for the user leaves site case and not the browser close. Here is the code I tried: <html> <head> <title>Detecting browser close </title> <script type="text/javascript"> function doUnload() { myWin= open("exit_site.php", "exitWin", "width=50,height=50"); } </script> </head> <body onunload="doUnload()" <h4>Close browser!</h4> </body> </html> Neep your help, please hi experts, I need to open same url (flash streaming site) on multiple tabs (min 100 tabs) without crashing my browser or drinking all my cpu usage. Pls dont ask me why i need to open like that. The question is can it be done. Thanks Hi I am a new bie to Javascript programming. We have a scenario to launch a new browser window for a given HTML. I have the following approaches : Approach 1: my_window = window.open("", "report"); my_window.document.open(); my_window.document.write("<HTML> <BODY> HI </BODY></HTML>"); my_window.document.close(); Approach 2: var newWindow = window.open("", "report"); newWindow.document.body.innerHTML = "<HTML> <BODY> HI </BODY></HTML>"; Could anyone sugges Which is the correct approach ? Our requirement is to have this code to work in any browser? Thanks I have found this Alarm Clock from JavaScript Kit and when the alarm time is reached it redirects to the URL entered. I would like to keep the alarm clock running, have it open a new window for the entered URL such as (Target="Blank") in HTML. Can someone help? var jsalarm={ padfield:function(f){ return (f<10)? "0"+f : f }, showcurrenttime:function(){ var dateobj=new Date() var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateo bj.getSeconds()) this.ctref.innerHTML=ct this.ctref.setAttribute("title", ct) if (typeof this.hourwake!="undefined"){ //if alarm is set if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){ window.location=document.getElementById("musicloc").value } Hi, I have long polling functionality working with Google Desktop Notifications. http://blog.perplexedlabs.com/2009/0...-long-polling/ However if I have multiple tabs open then the Notification received from the server is duplicated on every tab. Is there way to prevent this from happening as it should only appear once? Thanks suggestions welcome !!
Hello, It is my first post here so hello everybody I am currently building a website and it is the first time I have experimented with ajax, jquery etc etc so forgive me if I come across as a bit of novice in all this but ......... I am. lol I have a column of links that use ajax to load content into the adjacent DIV, and I have used the loadobs function to load the JS and CSS files along with the external file. Now within the external file I have used javascript to create a 3 tab section; when you first load the page it is fine BUT if you navigate away from the page and then try going back and loading the same external page then the tabs stop working and all the content of the tabbed sections stack ontop of one another as though the javacript isnt working? I am completely new to javascript but I think it is fabulous and I am keen to learn the ins and outs and would be really greatful if someone who knows what they are doing could point me in the direction of where I am going wrong or maybe what part of the code could be causing the error. It is a work in progress but the page I am having the problems on can be found at http://www.hm-designs.co.uk/crossland/solo.php if you click on the top link in the left hand column called Tara - Female vocalist you will be able to see where the tabs are. Thank you in advance if anyone may be able to help me Kind Regards, Helen hie everyone plz i want to know how to make tabs using javascript.... i want to make tabs like this website http://traveline.idea-sys.net/CSP/Default.aspx?A=2&P=50 --> (M/S Darakum - Description / GalleryDeck / Plan) can anyone help me plz? I have 3 tabs with a flash video playing in each. If a user clicks on a video and then decides to move to another tab while the video is playing.... the video stops and the tab is switched. I am using the code below to achieve that. Code: onClick=player1.sendEvent('STOP'); player2.sendEvent('STOP'); player3.sendEvent('STOP'); this works fine if I have the tabs appearing in sequence with player1 embedded in the first tab, player2 in the second and player3 in the third. However, I wanted to randomize the tabs, in which case if tab 3 containing player3 appears first and is played and then the user switches to another tab the video keeps playing.... meaning the above code does not work in that instance. I am at a loss here cause i thought that the onClick event should be going through all the players and stopping them. website: http://tinyurl.com/ydalz2r (at the moment the tabs are displayed in sequence) Hello! Looking for some help/advice please. Imagine a wife has signed on to a web site in a browser tab. She does not sign off and walks away to do something else. Her husband sits at the computer and seeing her signed on, opens a new tab and tries to sign on to the same site. I am trying to write a script that will close other tabs/windows when the husband goes to the same site to sign on. So, on the sign on page (or even better, the sign off page), when the sign on button is clicked, a piece of Javascript code is run first. The javascript simply goes through all tabs on the browser, and checks to see if any such tabs has an HTML document that came from the same domain as the sign on page. If such tabs exist, then before POSTing the user name and password to the server, the Javascript code will close those tabs that contain HTML documents came from the same domain. So, I understand I need to set the window.name to a specific value. But does anyone know what the code on the sign on/sign off page to close the other tabs/windows would look like? Thanks so much for any and all help. Hi, I want to restrict opening my popup window if it is already opened. For simple scenario, it is quite possible to do but in my case -- 1) When parent page is opening popup window, it is getting refreshed (required from client for some reason). 2) Once submit button is clicked from popup window, again parent page is getting refreshed (again its a requirement from client side). With these 2 conditions, I lost my saved value from variable and hence new popup is keep coming when the action is same. Currently I am using below code to open popup [CODE] function OpenWindow() { if(winPop && !winPop.closed) { alert("Popup is already open"); } else { winPop = window.open('MyPopupPage.aspx'); } } [CODE] Please help me to get rid of this problem. Thanks in advance. - Bhasker I have an javascript coding issue with regards to a tabbed menu. The code is supposed to hide the unselected divs and show the selected div, but all divs are showing and no tab is selected when the page initialises. The source code is viewable he http://www.kenaani.co.uk I was following this tutorial: http://www.elated.com/articles/javascript-tabs/ Which works fine in this example: http://www.elated.com/res/File/artic...ript-tabs.html I have tried commenting out the other scripts, and the divs still show on the page, so I don't think its a conflicting issue. Am hoping that someone can spot whatever is going wrong. Can someone tell me how to make a close button for this? The close button I currently have here makes the IMAGE2 disappear but I cannot see IMAGE1 until the time runs out on the setTmeout. I want to be able to click the closeX and close out the whole script leaving IMAGE1 showing. Here is what I have: Code: <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350"> <tr> <td align="center"> <script type="text/javascript"> window.onload = function () { setTimeout(function () { var div = document.getElementById('hideOverlay'); div.innerHTML = 'IMAGE1 GOES HERE'; }, 6000);} </script> <div id="hideOverlay"> <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350"> <tr> <td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="var lyr =document.getElementById('hideOverlay'); lyr.innerHTML='';"/><font color="#666666" size="2">Close [x]</font></a>IMAGE2 GOES HERE</td> </tr> </table></div> </td> </tr> </table> </div> I made a private message page that shows as a popup but the problem is it wont close itself after a 3 second (3000 millisecond) pause Code: <script type="text/javascript"> setTimeout("self.close();",3000); </script> This was the original code I found: Code: setTimeout('self.close();',30000); **FIXED** I was trying to close a tab instead of the window. The popup was a window that had a set url that could not be changed so i used a tab to access the page I wanted. Tested and works now The web page belows works OK in IE and FireFox on XP and Windows7 It does NOT work on IPAD using Safari. Question: How can I delete the new window("IPADREPORT") when I run it the second, third,fourth, etc time ? How can I get the window name( "IPADREPORT") to see if it exists? SUggestions? TIA, Steve42 <code> [aSafari.html] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <script language="JavaScript" type="text/javascript"> function pReport(){ // 1-17-12 var menuWindow = open("","ipadreport"); // 1-17-12 menuWindow.close(); // above closes previous report window var menuWindow = window.open('','ipadreport');// 1-17-12 document.ipadreport.submit(); menuWindow.focus(); } </script> <title>Ipad_PopUp_Test</title> </head> <body> <br><br> <form method=post name="ireport" target="ipadreport" action="http://myreport.asp"> <input type="hidden" name="reporttest" value="apple"> <a href='javascriptReport()'> Create Report</a> </form> </body> </html> </code> How to center javascript popup without css? Cant get close button working(wrong position and dosen't close popup). Code: <script language="javascript"> function openPopup(a, b, c){//a = url, b = width, c = height var pOverlay, pContent, pClose; pOverlay = document.createElement('div'); pOverlay.className = 'popupOverlay'; pContent = document.createElement('div'); pContent.className = 'popupContent'; pClose = document.createElement('div'); pClose.className = 'popupClose'; document.body.appendChild(pOverlay); document.body.appendChild(pContent); var myRequest = new ajaxRequest(); myRequest.open('GET', a, true); myRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); myRequest.send(null); myRequest.onreadystatechange = function(){ if(myRequest.readyState == 4 && myRequest.status == 200){ pContent.innerHTML = myRequest.responseText; } } } </script> Code: <style type="text/css"> .popupOverlay { background: #000000; opacity: 0.8; position: fixed; top: 0%; left: 0%; width: 100%; height: 100%; z-index: 1001; } .popupContent { background: #333333; border: 2px solid #DDDDDD; box-shadow: 0px 0px 20px #999999; border-radius: 3px; position: absolute; top: 50%; left: 50%; padding: 5px; z-index: 1002; overflow: auto; word-wrap: break-word; color: #FFFFFF; /*height: 300px; width: 500px;*/ } .popupClose { background: url('images/closePopup.png') no-repeat; width: 32px; height: 32px; cursor: pointer; } </style> |