f



in popup window, checking if page in opener window - any help?

Hi,

I have a little test script in a pop up window. The pop up page 
refreshes every 2 seconds. I want it to check with every refresh if a 
certain page (log3.htm)  is loaded in the opener window. If that is the 
case, another page (log4.htm) must be loaded in the opener window.

In pop up page:

<script>
<!--
if (opener.location.href="log3.htm")
   {opener.location.replace("log4.htm")}
//-->
</script>

But it aint working :(  What happens is that the condition doesn't work, 
because with *any* page in the opener window, it is replaced immediately 
with log4.htm when the pop up refreshes -  log4.htm should only be 
loaded automatically when log3htm is in the opnener window. So pop up 
and opnener parent do communicate.. but just not as I'd like them. 
Anyone??

*&%$
Thnx 


0
JPL
2/14/2005 3:08:09 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

4 Replies
751 Views

Similar Articles

[PageSpeed] 54

In article <4210bed5$0$44109$5fc3050@dreader2.news.tiscali.nl>, 
matterDELminds@hotmail.com enlightened us with...
>> 
> <script>
> <!--
> if (opener.location.href="log3.htm")

Fundamental error.
=
==
The first assigns.
The second compares.
if (opener.location.href=="log3.htm")

-- 
--
~kaeli~
The more ridiculous a belief system, the higher probability 
of its success. 
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

0
kaeli
2/14/2005 3:56:37 PM
JPL Verhey wrote:

> if (opener.location.href="log3.htm")

The comparison operator is "==", not "=".

>   {opener.location.replace("log4.htm")}

> with *any* page in the opener window, it is replaced
> immediately with log4.htm when the pop up refreshes

The assignment you accidentally typed always evaluates to "true" since
you assign a string that's not the null string. In addition, the href
property will most likely contain more than "log3.htm" (protocol,
hostname, and path info), and you should look if the opener window is
still there:

if (
  opener
  && !opener.closed
  && opener.location.replace
  && opener.location.href.match(/log3\.htm$/)
)
  opener.location.replace("log4.htm");

ciao, dhgm
0
Dietmar
2/14/2005 3:59:53 PM
"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message 
news:MPG.1c7a862830a896a798a307@nntp.lucent.com...
> In article <4210bed5$0$44109$5fc3050@dreader2.news.tiscali.nl>,
> matterDELminds@hotmail.com enlightened us with...
>>>
>> <script>
>> <!--
>> if (opener.location.href="log3.htm")
>
> Fundamental error.
> =
> ==
> The first assigns.
> The second compares.
> if (opener.location.href=="log3.htm")

Ok thanks! Wasn't aware of that.



0
JPL
2/14/2005 4:08:46 PM
The below works! Brilliant, thanks alot..

"Dietmar Meier" <usereplytoinstead@innoline-systemtechnik.de> wrote in 
message news:37c099F59go02U1@individual.net...
> JPL Verhey wrote:
>
>> if (opener.location.href="log3.htm")
>
> The comparison operator is "==", not "=".
>
>>   {opener.location.replace("log4.htm")}
>
>> with *any* page in the opener window, it is replaced
>> immediately with log4.htm when the pop up refreshes
>
> The assignment you accidentally typed always evaluates to "true" since
> you assign a string that's not the null string. In addition, the href
> property will most likely contain more than "log3.htm" (protocol,
> hostname, and path info), and you should look if the opener window is
> still there:
>
> if (
>  opener
>  && !opener.closed
>  && opener.location.replace
>  && opener.location.href.match(/log3\.htm$/)
> )
>  opener.location.replace("log4.htm");
>
> ciao, dhgm 


0
JPL
2/14/2005 4:09:50 PM
Reply:

Similar Artilces:

Popup window that darkens the window that opened it
Hi I just visited a website and saw how they darkened the background page when a popup was opened. How can I do this using JS and HTML? Is it a normal popup window? TIA On 8 Lis, 13:35, "WhatsPHP" <futureo...@gmail.com> wrote: > Hi > > I just visited a website and saw how they darkened the background page > when a popup was opened. How can I do this using JS and HTML? Is it a > normal popup window? > > TIA How is your question connected with PHP? Try this javascript library: http://prototype-window.xilinus.com/samples.html , the 4th example. ...

Window opens behind current window; Window opened in TREE_ITEM_ACTIVATED event handler
Hi, I'm trying to write a program where I dbl-click an item in a wxTreeCtrl, which then opens a window (class invoicewin: public wxFrame). The window/frame opens, but it's behind the window that contains the wxTreeCtrl that was dbl-clicked (class BrowseInvoices: public wxFrame). My code (in the wxEVT_COMMAND_TREE_ITEM_ACTIVATED event handler) is: iwin = new invoicewin (mainwindow, invoice); iwin->Show (true); iwin->Raise (); Anything obviously wrong with this? Craig -----------------------...

Child windows can not access window.opener when multiple child windows are open
I have a parent window that pushes a new window object onto an Array with the following code : OpenChild() { //totalNumWindowsCreated is global totalNumWindowsCreated = totalNumWindowsCreated + 1; childWnds.push(window.open(link, "child" + totalNumWindowsCreated,"dependent")); .. .. .. } This pops up a new window with every call. In the child window I call a parent function onbeforeunload, appClose() : function appClose(){ if (window.opener && !window.opener.closed){ window.opener.CloseChild(getQueryString("application")); } } This is in my frames...

window.open() and the JavaScript content in the new window.
Hello, I created the following sample HTML/JavaScript of my problem. I have a MAIN page. When it is loaded, I want to open a new window that contains the same JavaScript as the main window: <script type="text/javascript" > alert("OK"); </script> My problem here is the new window have an error: Object expected. This is the source code of the new window: <html><body><table><TR> <SCRIPT type=text/javascript> alert("OK"); </SCRIPT> </TR></table></body></html> I realize the proble...

window.open() opens two windows
Problem: using a named window as target, a new window is opened anyway. Also, both windows have the same name. This happens on SOME machines only env: XP sp2 ie6.0.2900.2180 + sp2 Replicate with these two files, "test1.html" <HTML><BODY> <script> function openit(){ var addlookup=open('about:blank','addlookup'); document.f1.target="addlookup"; document.f1.submit(); } </script> <form name=f1 action="test2.html" > <input type=button onclick="openit();" value="open"> </form> </BOD...

window.open() Not Opening in Same Window All The Time
Hi All, I'm having a problem that is driving me absolutely batty and I'm hoping that one of you JavaScript gurus can help me out before I go stark raving mad. I am using the function shown below to open links into the same pop-up window each time a user clicks any of the news story links contained in http://www.kris.ca/newsroom.aspx. The function works perfectly for all of the links except for the ones from the BBC's website. Links to stories from the BBC's website insist on opening in a new popup window each time no matter what I do. This behaviour is consistent in both IE and Firefox. The behaviour makes absolutely no sense to me as all of the links use the same function call. Any ideas? function popupfeed(url) { var myfeatures = "toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=800,height=600"; thefeed = window.open( url, 'feed2jspop', myfeatures); if (window.focus) {thefeed.focus()} } k.vanderstarren@gmail.com wrote: > Hi All, > > I'm having a problem that is driving me absolutely batty and I'm hoping > that one of you JavaScript gurus can help me out before I go stark > raving mad. > > I am using the function shown below to open links into the same pop-up > window each time a user clicks any of the news story links contained in > http://www.kris.ca/newsroom.aspx. The function works perfectly for all > of the links except for the ones from th...

Access denied in javascript when try to see contents of page in javascript opened window
Hello I am trying to write some javascript that will open a new web-page in a new window and then be able to determine if the web-page that has been opened contains certain text. I am opening the new window with: newpage = window.open("http://www.somewebaddress.com/ index.html","newpage","width=400,height=200,left=400,top=300,resizable=1,status=1,scrollbars=1"); I am then trying to see if it contains certain text by using: if(newpage.document.getElementsByTagName('body')[0].innerHTML = = "text") alert("contains the text"); However...

refreshing main opener window from a second (popup) window
Hello, I'm having problems refreshing a main window, and am not sure really whether the solution will be Javascript or PHP related. Firstly, I have a main file that calls a pop-up box which enables comments to be made about certain images on the page. The pop-up makes a connection to a MySQL database and the existing comments are put into a PHP array and echoed to the screen. I use a GET argument to send the image ID to the pop-up. If a name instead a number is passed, it creates a new entry in the DB under this name. However, the main problem is that if the pop-up is closed down, unle...

javascript popup window that stays in front of parent window?
I have a couple of utility windows - a calculator and a calendar that popup from my main window. I would like them to always stay in front of the parent window until they are shut down with there own close buttons. As it is, when you click back to the parent window, of course it comes in front of the child windows. Can I do this? You can use the showModalDialog method! http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref erence/methods/showmodaldialog.asp "Simon Wigzell" <simonwigzell@shaw.ca> wrote in message news:NC29b.950877$ro6.18862355@news2.c...

window.open() and the JavaScript content in the new window. #2
Hello, I created the following sample HTML/JavaScript of my problem. I have a MAIN page. When it is loaded, I want to open a new window that contains the same JavaScript as the main window: <script type="text/javascript" > alert("OK"); </script> My problem here is the new window have an error: Object expected. This is the source code of the new window: <html><body><table><TR> <SCRIPT type=text/javascript> alert("OK"); </SCRIPT> </TR></table></body></html> I realize the proble...

Setting the value of window.opener from popup window name
Hi Everyone - I have a data entry form that allows the user to click a button and have that button popup a list of available values - the code on the popup window uses the name of the form to determine what field to populate on the opener... function sendComment() { var x x = document.canned_comment_form.lb1.value; name = self.window.name; if(name == "CMT1") { window.opener.document.main_form.comment_1_tb.value = x; } if(name == "CMT2") { window.opener.document.main_form.comment_2_tb.value = x; } if(name == "CMT3") { ...

window.open opens a full window in Netscape4 !!!
Hello The following code opens a small window in IE and NS6, however it opens a full window in NS4+ : open("somepage.html", "", "width=568, height=320, scrollbars=yes"); what can be the reason? Thanks in advance, Kiran Makam kiranmn75@yahoo.com (kiran) writes: > The following code opens a small window in IE and NS6, however it > opens a full window in NS4+ : > > open("somepage.html", "", "width=568, height=320, scrollbars=yes"); > > what can be the reason? The spaces in the parameter string, after the commas. Remove them, and it works. /L -- Lasse Reichstein Nielsen - lrn@hotpop.com Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html> 'Faith without judgement merely degrades the spirit divine.' I tryed this code: open("somepage.html", "", "width=568,height=320,scrollbars=yes"); but still Netscape4 is opening full window ! Kiran Makam "kiran" <kiranmn75@yahoo.com> schrieb im Newsbeitrag news:7ca8b853.0307222006.299acb85@posting.google.com... > I tryed this code: > > open("somepage.html", "", "width=568,height=320,scrollbars=yes"); > > but still Netscape4 is opening full window ! > > Kiran Makam Have you made sure somepage.html does not contain javascript code to control the window size? Just an idea. -- Markus I am using NS 4.79 on Win 2000...

Popup windows ("window.open") no longer works!
For some reason pop up windows are no longer working on my pc. And no, I dont have any popup killer installed. The problem is across all websites I look at on my browser. Is there any obvious reason this might happen? I haven't changed any settings, but if there's somethign I could check I'd be grateful if someone could point it out to me! Thanks! Owen "owen" <spam@spam.com> wrote in message news:3jW9b.3720$YL1.1381685@newsfep2-win.server.ntli.net... > For some reason pop up windows are no longer working on my pc. And no, I > dont have any popup k...

opening new window in one window using Tkinter -- Help please
Hi,... I meant to write an application where there is a button in a window and when you click on the button, it will open a new window, but I want the first window to close, replaced by the second window. I open a login window and start the mainloop, when the user click on the login button, the __call__ function of VerifyProcessor is executed and it will call the new window which is the file manager window The thing is,.. I don't know how to exit the first mainloop and then display the second window...I even tried calling the mainloop again but a weird thing happens. I really need help bec...

HELP: need to customize the size of the window.open window for different links
Hi - thanks for reading this out there! I'll be quick about it: I've got this row of images (in the end there will be more rows of pics as well). When a user clicks on the image, I want a new window to open with a larger version of the image. I want that new window to be customized to the size of the new larger image. Also, when users go back to see other images in their larger size, I want the new window (assuming they never closed the first one) to come back to the front. I've only gotten as far as getting the larger images to open in a new window at a set size in the functi...

Main window call Javascript function in popup window, and vice versa
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for main window to call function in the popup window, right? The following is a sample code (close popup window causes to show alert window) which doesn't seems to work. Can anyone see the problem? // main window ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <html><head></head><body onLoad=...

window.open - trying to display a new window with a different title
I need to open a new window from an existing HTML page to a site in which we do not want to show the address for. I have set the titlebar to no but it will still place the title on the titlebar Here's my function code: function myOpen() { window.open("http:// www.somewhere.com","mywindow","location=no,titlebar=no"); } I am calling it by the following line: <img src="art.gif" onclick="myOpen()"> Any help you can provide would be extremely appreciated!! thanks, LB linab2007@gmail.com said the following on 5/30/2007 11:09 ...

verify popup window is open from multiple pages
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses pageA.html 2. User clicks on menu link to open popup.html 3. pageA.html checks if popup.html is already open. It is not, open popup.html. 4. User switches back to pageA.html (does not close popup.html) 5. User clicks menu link for pageB.html. 6. System displays pageB.html 7. User clicks menu to open popup.html 8. pageB.html checks if popup.html is already open. If it is, focus is made on popup.html. If...

again HELP: checking content in opener window with frameset
Hi, With a script in a popup window, I want to check if certain content is present in a page loaded into the frame "main" of the frameset in the opener window. I started with something like this (what happens when the considions are met already works): if ( ... && opener.window.frames['main'] ........................??? ... ) ....but have no idea how to proceed..and if this beginning is ok! Assume there is an image <img src= /photo.jpg> in that page in the 'main' frame of the opener window.. can I check that out with this script?? Or are there ...

AjaxAnywhere fail to refresh zone after create popup window by calling window.open()
I'm getting the error "AjaxAnywhere error : content-type in not text/ xml :[text/html ..." withe the following dummy-testing code. Why? Many Thanks, Jimmy <!-- ---------------------------------------------------------------------------------------------------------------- --> <aa:zone name="testZoneToRefresh"> <script type="text/javascript"> // <![CDATA[ var testAjaxAnywhere = new AjaxAnywhere(); function testPopup() { var testPopup = window.open("http://someOtherServer/remoteWebApp", "testPopupName", &qu...

Opening 'iSeries Access for windows from a windows program'
Hi there!! I am a windows programmer (VB, VC++ etc). I have used 'iSeries Access for windows' emulator to log in and look data and stuff. Now I am asked to write a program in windows (VB or any other language) that calls (opens) emulator program. Let's say I have a function called 'find customer' when I log in through iSeries Access for windows emulator. Say it can be searched by name or SSN. Now how do I write a windows program that will directly take to emulator screen by passing on parameter like SSN. To make it clearer, I do not want to fetch data into windows program....

window.open, target=_blank opens two windows
The code: <a href="/art/visit/openhouse03/images/17.jpg" target="_blank" onclick="popCenter(this.href,'name','500','500','no'); return false;"> <img src="/art/visit/openhouse03/images/thumb17.jpg"></a> The problem: I always get two windows. I have the required "return false". I found a post (http://tinyurl.com/avjlh) that addresses my exact problem, but they told the guy he wasn't returning false properly. That doesn't make any sense. I could hack it by targeting the same window that J...

Can I retrieve the object of the window opened by window.open
I know I can get the window object by using obj = window.open( .... ); but what I need is, after the new window is popped up, the opener will be redirected to another page, I want the another page able to control the popup window is it possible? is there something like getWindowById Thanks a lot! sowen said the following on 8/8/2007 11:35 AM: > I know I can get the window object by using > > obj = window.open( .... ); > > but what I need is, after the new window is popped up, the opener will > be redirected to another page, I want the another page able to contro...

window.open special window
Hi NG, When I open a new window like that: mywin = window.open("","mynewwindow","menubar=no,status=no,toolbar=no"); then the new window has still a status line in the bottom and the window has on top a fat blueline with the title of the document. BUT I want a window where there is no grey line in the bottom and no fat blue line on top. I think I have seen that somewhere, but can't find a window like that in the moment. Is it possible to create such a window?? Thanks Achim hakim wrote on 08 okt 2005 in comp.lang.javascript: > When I open a new window ...

Web resources about - in popup window, checking if page in opener window - any help? - comp.lang.javascript

Design rule checking - Wikipedia, the free encyclopedia
Design Rule Checking or Check(s) ( DRC ) is the area of Electronic Design Automation that determines whether the physical layout of a particular ...

Facebook Restores Access To Tumblr Page Obama Is Checking Your Email, Blames Automated Response
... , of any knowledge of or participation in Prism. A few eyebrows were likely raised over the weekend, when access to Tumblr page Obama Is Checking ...

The Getting Started Series: Checking Performance of your Facebook Ads
Use Ads Manager to check performance of your Facebook Ads.

State of Journalism: The Lost Art of Fact Checking
... Read all the posts here.It wasn’t exactly Bright Lights, Big City. Jay McInerney’s well State of Journalism: The Lost Art of Fact Checking March ...

Random people from the FiDi and Flickr HQ team checking out Venus transit of the Sun (2012) - Flickr ...
John Ubante had his Canon rig set up for the Venus transit Flickr HQ staff and lots of passers by stopped to check out the show.

Checking Your Privilege: A How-To for Hard Things - YouTube
Leslie Hawthorn http://lca2015.linux.org.au/schedule/30258/view_talk Over the past 3 years, we’ve witnessed the discussion of the role of women ...

Q&A: Checking rego date
Hugo is wondering what is the best way to check vehicle registration date now that cars no longer have rego labels in NSW.

Australian Paralympic Committee checking review on Canberra swimmer Hayley Morris
Australian Paralympic Committee chief executive Jason Hellwig wants to be assured the correct protocols were followed for Canberra teenager Hayley ...

Australian police checking MH17 site
Independent monitors are helping Canberra negotiate with armed rebels over access to the MH17 crash site.

Q&A: Checking rego date
Hugo is wondering what is the best way to check vehicle registration date now that cars no longer have rego labels in NSW.

Resources last updated: 3/11/2016 8:51:40 PM