JavaScript - Window.opener.location
Hello
In phase of my deployment I send the user a window from a servlet and inorder to communicate with an applet already loaded in another window in the browser I thought I could set the window.opener.location="${formbean.property}"; and it partly works, it get set, I see the new window flash, but it then executes that url. Two questions? 1. setting the window.opener.location in an onLoad() should not force a post back to the server, correct? I am just trying to keep that window I want up there and set an internal property so I can access the applet in the other window. Trying to make this "synthetically" a child of that page opened with the applet so I can call the applets methods simply. 2. Is there another way for a new browser window to directly access an applet in another page? I could go the route of making a probe applet and hoping they share the same JVM, (JRE1.6.0.25) access it that way. Is/how that the way to do it? Similar TutorialsHello, Here is what I have: a regular main window that opens a small pop-up for preview purposes. This pop-up window has a text link to close it and a text link to close it and reach a page with more detail in the main window. I have been trying an infinite number of things so far and I cannot get this last link to work in Opera 10. All workarounds are just fine in FF 3 and IE 8. Here is the function called when clicking the link to "close and go": Code: <script type="text/javascript"> function fermer_extrait() { window.opener.location='http://www.wereIwantToGo.com'; window.close(); } </script> I have tried the same thing with Code: window.opener.location.href='http://www.wereIwantToGo.com'; and some other window property like "outerWidth" for testing purposes. In every case, Opera doesn't do anything when I click that link and I get this error: Code: JavaScript - http://www.mypage.php Event thread: click Error: name: ReferenceError message: Security error: attempted to write protected variable 'href' stacktrace: Line 1 of function script window.opener.location.href='http://www.wereIwantToGo.com'; window.close() "protected variable" will change according to the attempt I made (href, location, outerwidth). I'm gessing there is something very strict in the way Opera handles javascript. I'm a beginner and I have reached my limits. This is where I ask for help... So, how can I get that pop-up to close and get the main window to change location? Thanks in advance for any help! Here is my issue: I am opening a popup from the main browser window, where the use logs in to a 3rd party site. After logging in, the popup window is being redirected to our site, where I have to send back a message to the original window. I am using window.opener for sending the message. Everything works fine in IE*/Firefox/etc, but if the 3rd party site is added to the trusted sites in IE, the window.opener won't work anymore. Why does this happen? How could this be resolved? Thanks in advance, norbip Hello, I have a problem with openers. I have a form (A) and there is a link, which opens a popup-form (B). On that Popup there is a link, which opens one more popup-form (C). When closing last one (C), I try also to close also opener (B) and then to refresh openers opener (A). I can find opener (B) and submit it and close myself (C) as: Code: var win = window.opener; win.document.getElementById("xxform").submit(); window.close(); Code: <script language="JavaScript" type="text/javascript"> function confirmDelete(url){ var decision = confirm("Click OK to delete this post."); if(decision == true){ window.location = url; } } </script> <!--HTML LATER ON --> <a onclick="confirmDelete('deletePost.php?id=17')" href=''><img src='delete.png' alt='' title='Delete this post' /></a> I get absolutely nothing out of this. The confirm box pops up, but a the URL never changes when I click OK. I have no clue what's going wrong here. I'm using Google Chrome to test this out if that helps. Also does not work in Firefox. What are the differences between results of these two. Code: window.location.hostname or Code: document.location.hostname Hi there im making a estate agency website for my college assignment and have come across a problem when using windows.location for some reason it is not working what i want to do is go to a page when searching the right content and then clicking the submit button so when i type hello for example into the text box i want to get relocated to renting1.html page but for some reason it is not working i know that the variable is set up right as if i change the content of the if statement to an alert then that works can anyone spot a problem in my code snipit <form id="form1" method="post" action="" > <label>Search House Name: <input name="Search" type="text" id="Search" size="50" /> </label> <label>Search <input type="submit" name="Search2" id="Search2" value="Submit" onclick="testResults()" /> </label> <script type="text/javascript"> function testResults() { var TestVar = form1.Search.value; if(TestVar=="hello") window.location = "renting1.html"; else alert("Invalid"); } </script> thanks for any help dave Can someone tell me how to change the following code so that it will open in a new window? (like target="_blank" in html) Code: if (phone_num=="1234") document.location="http://mysite/formgov/makeadifference.html"; I have searched for hours trying to find a solution and have tried many things, nothing has worked. The example shown above is just one of many urls that I want to change. Any help would be appreciated. Maybe this is not possible. I know nothing about javascript. If you go to: http://ocmd.freehostia.com/tbb/ You'll see that when the user presses enter, it goes to another page. Currently, in the scripts part of my page is this: Code: function checkKey() { if (window.event.keyCode == 13) { var audioElement = document.createElement('audio'); audioElement.setAttribute('src', 'horse.ogg'); audioElement.play(); window.location = "google.html"; return false; } } Notice how I'm trying to play an audio file? Well, I need for the window.location to go after the audio file plays, or alternatively for it to be played after xx milliseconds. Thank-you. Hi, I have a requirement of parent and child window. Onclick of a link on the parent page i am opening a child window with "window.location". On the child window i am displaying a jsp with the overlap screen on the parent screen using DOJO. After doing all the action on the child page when i am about to close the child window which is having button like cancel,close i am hiding the overlap screen. But my actual concern is when i close the child window, my parent page's scroll bar is scrolling down to the bottom of the page which should not happen and it should be there at the top of the page. How can i acheive this behaviour. Can anyone help me in this. Thanks in advance Hey guys. I'm currently paying for a web service on a hosted platform. Basically, I'm unable to edit any raw content, however I am able to do things like add JS/HTML to the header or footer of a page, which will in turn be displayed on every page of this platform. My dilemma is, I only want content being showed on a single page of the platform. Specifically, I want a window.alert being displayed on the "/signup" page, but all I have to work with is JS in a global footer. Is there some way I can use window.location to achieve this? I guess this is an easy question for all javascripters but I don't know how to manage (I'm pretty fresh with JS). I found two solutions on this forum but it seems that they don't work(?). I want to delay for few seconds window.location.href="destination_site.html" before it will automatically take visitor to destination site. It has something to do with setTimeout but I would be greatful for posting a fixed code. Thanks in advance. how can you do onclick="return getconfirm('do you want to logout?');" onClick="window.location('logout.asp');" on the same button , if confirm then go url else stay here ? thank you dears, am trying to redirect user from onchange event to another location in the page. its work fine in IE but not in firefox :-( why window.location doesn't work in FF ? Html: Code: <form name="forder"> <select name="bycat" onchange="gocat()"> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> </form> javascript: Code: function gocat() { window.location ="index.php?show&cat=" + forder.bycat.options(forder.bycat.selectedIndex).value; } any idea???? Sorry, this is a newbie question, and probably really dumb, but... If I create a function that looks like this... Code: function recall(tim) { setTimeout("window.location.replace('somepage.html')",tim); } ...it works fine when called. However; I want to be able to pass the page url in a variable, something like this... Code: function recall(tim, myurl) { setTimeout("window.location.replace(myurl)",tim); } ...but this creates an error, saying "myurl is not defined." Even if I simplify the code and place the url in a variable within the function... Code: function recall(tim) { var myurl="somepage.html"; setTimeout("window.location.replace(myurl)",tim); } ...I still get the "myurl is not defined" error, even tho I am defining it. Plz can someone explain what I'm doing wrong. Tkx... --paul I know next to nothing about javascript and I don't even know if this is possible. I need to target window.location.href to an iframe on a different page. So, right now, the piece of the code that redirects the browser looks like this: Code: window.location.href='http://www.somewhere.com/'; Works great, brings it up in the same browser window. So now I need to modify the code so it goes to a different page and brings that page up in a specified iframe. I hope this makes sense. I really need help. And if it is not possible, I just need to know to abandon all hope. EDIT: I SOLVED THIS BY USING "#" instead of "?". Thank you. Hello. My goal is to take a user's email from a form, store it in a cookie, and append it to the window location on the following page. I am doing this so that when a user shares the page with "add this widget" the stats will show me who shared the page. The problem I have is that window.location.replace("?"+ user_email); seems to be sending the browser in an infinite loop. Right now it is running as an inline function in the head. I tried calling the function with body onload and had the same problem. Code: <script = "Javascript"> (function readCookie() { var user_email = unescape(document.cookie); if (document.cookie) { window.location.replace("?"+user_email); } })(); </script> Is there another way I could achieve the same result? Thank you, Jack Hi, I am facing a problem with Mozilla Firefox. The below line works fine with IE but not with Mozilla Firefox: top.opener=top.opener.frames['frameName']; The value of top.opener doesn't change in Firefox. Can't we change the value of top.opener in Mozilla Firefox? Thanks & regards, Raj Hi, I'm very new to javascript and don't really ask questions in forums because i usually find what I'm looking for in other threads. I have a situation where I open a popup window from what I'll call "the main page", insert some text and open a 2nd popup from there. After making a selection, that window closes to bring the 1st popup back to focus. When I submit the form in that window, some info is changed in a database. How can I refresh or reload the main page to show the changes? Is the "main page" still the opener after opening and closing windows?
Bonjour all. I am trying to activate a function once an iframe is closed. so i am trying to use: window.opener.pageUpdate(); which i get an error of Error: window.opener is undefined Source File: https://web111.secure-secure.co.uk/s...js/thickbox.js Line: 270 Which lead me to believe that my parent window has not got a name so i used window.name = "main"; in my parent and window.main.pageUpdate(); in the child and get same kind of error. Could someone please help me out! Hi, my employer found a shell html file with just a script on it as in the title PHP Code: <script type="text/javascript"> window.location="/controlPanel" </script> Can anyone tell me what this might be doing? He said he doesnt even remember uploading this file to his site. I tried googleing the code, but didn't find specifically what it is. I think maybe its a redirect of sorts, but not sure, and definately not sure why we have it or how we have it. Thanks for any help! |