473,546 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page should detect parent.window

Hi,

I'm sorry if this has been asked before. I'm a designer and occasional
javascript hacker, not a javascript writer. I cannot believe I have
spent over 4 hours searching for this on Google and nothing I have found
solves this silly little problem.

Background
----------
I have been assigned a poorly-designed site to SEO. It has a number of
popup pages which the client refuses to remove.

The Problem
-----------
These popup pages have already been indexed by Google and when they are
clicked on from a page of results they obviously display with no
navigation menu because they are designed to be standalone popups.

The Solution
------------
If the popups are called from the site's home page (the only page from
where these popups are called) then they display as above. If these
popups are called from anywhere else (e.g. a search result on Google)
then the page should either refresh using self.location.h ref to the
site's home page or maybe use document.write to include a link back to
the site's home page.

I have determined that I need to name the parent.window and that I need
to detect that name when the popup is loaded. But I cannot, cannot find
any tutorial on how to achieve this, yet there are millions of popup
pages in sites that must have this very problem. If anybody could help
me with this I would be very grateful.
Jul 19 '06 #1
1 4835
Jessica wrote:
Hi,

I'm sorry if this has been asked before. I'm a designer and occasional
javascript hacker, not a javascript writer. I cannot believe I have
spent over 4 hours searching for this on Google and nothing I have found
solves this silly little problem.

Background
----------
I have been assigned a poorly-designed site to SEO. It has a number of
popup pages which the client refuses to remove.

The Problem
-----------
These popup pages have already been indexed by Google and when they are
clicked on from a page of results they obviously display with no
navigation menu because they are designed to be standalone popups.

The Solution
------------
If the popups are called from the site's home page (the only page from
where these popups are called) then they display as above. If these
popups are called from anywhere else (e.g. a search result on Google)
then the page should either refresh using self.location.h ref to the
site's home page or maybe use document.write to include a link back to
the site's home page.

I have determined that I need to name the parent.window and that I need
to detect that name when the popup is loaded. But I cannot, cannot find
any tutorial on how to achieve this, yet there are millions of popup
pages in sites that must have this very problem. If anybody could help
me with this I would be very grateful.
I did it... and I did it all by myself!!

Here is the code should anybody else wish to use it:

<script language="javas cript">
<!-- // hide from older browsers

function checkOpener(pag e)
{
if (opener && !opener.closed)
{
opener.location ='../index.php';
}
else
{
self.location.h ref = "../index.php";
}
}
//-->
</script>

</head>
<body onLoad="checkOp ener('../index.php')">

If you paste this into your popup window and load that into a browser
window it will automatically refresh to "../index.php" but when you
click the link on "../index.php" that opens the popup window it does
what it is supposed to do, nothing. Obviously you change the
opener.location to whatever the page is called that contains the link to
the popup.

I'm very pleased with myself and I couldn't have done it without the
help of irt.org, whose tips and tricks pointed me in the right direction.

Jess
Jul 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1893
by: Andreas Leue | last post by:
Hi, I am writing a small, automated webapp-test-machine in javascript. It shall work with something like Mozilla/Netscape - IE is not a choice. In this context it is necessary to detect when a page finished loading - without having access to that foreign page and - without being in a parent-frame of that page I have consulted this group...
23
6481
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I know if Window.Open has been redefined? BACKGROUND:
4
8979
by: Mark | last post by:
I am loading source files into several iframes, with each load happening after some user-generated event (like clicking a button). The loading works but I need to determine when the source file is FULLY loaded so I can do some calcs on its scroll height within the frame. If I check the scroll height right away (after fetching the file),...
7
2147
by: Chris | last post by:
Can anybody tell me how to detect is the user has closed the browser Thank you
5
4468
by: Jeronimo Bertran | last post by:
I have a DataGrid that gets filled based on a filter which is defined by the values that the user selects on several controls. When the page postbacks after changing the selection on the filter controls, the DataGrid refreshes itslef. Now, I also need to refresh the DataGrid if I detect that something "external" has changed (keeping the...
7
8694
by: Ben Schumacher | last post by:
How can I refresh the parent page from a popup window that was created using window.showmodaldialog? I would like to accomplish this using vbscript if possible.
12
6216
by: Phil | last post by:
I can check for MdiChildren.Length=0, but which event handler should I put this in to detect when a child window is closed? TIA Phil.
1
4011
by: nupuragr82 | last post by:
I have a parent form and on button click I am calling a child page where i have a textbox and a button. On button click of child form I am passing the value of the Textbox to the Textbox in parent page and now I want to fire an event. Button click event on parent page- parameter is txtBlank (TextBox in parent page) function SetRange(Src) ...
29
3883
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a section of the page. This is the JavaScript code that I'm using to refresh the content in the parent page: <script type="text/javascript"> ...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7792
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.