473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to link from a "pop-up" window

Hello, all, and TIA for any help you can offer. I've searched the
Internet for answers and have finally come here.

I've created a page (several, actually) with a link that opens a pop-up
window. It's a pop-up window in the sense that it's smaller than the
man page and is intended to be viewed and then closed.

The problem is that if I include a link on that pop-up window HTML
page, when the link is clicked the new page opens IN the pop-up window,
which is not at all what I want. I want the pop-up window and the
window it came from to be closed out altogether first so that the new
page, the I link to from the pop-up window, opens in the user's default
browser view and the original pages are "released."

You can see a sample of the originating page with a link on it that
opens a pop-up window, whereupon you'll see a test link to google.
Please go to http://barelybad.com/map_test.htm.

Please understand that I am nearly illiterate in Javascript. I can
follow directions, and I can adapt within reason, but I really will
need some pretty detailed instructions as to what goes where in which
HTML page.

Thanks again for your time.

Oct 24 '05 #1
3 2220
Jo******@gmail.com wrote:
Hello, all, and TIA for any help you can offer. I've searched the
Internet for answers and have finally come here.

I've created a page (several, actually) with a link that opens a pop-up
window. It's a pop-up window in the sense that it's smaller than the
man page and is intended to be viewed and then closed.

The problem is that if I include a link on that pop-up window HTML
page, when the link is clicked the new page opens IN the pop-up window,
which is not at all what I want. I want the pop-up window and the
window it came from to be closed out altogether first so that the new
page, the I link to from the pop-up window, opens in the user's default
browser view and the original pages are "released."

You can see a sample of the originating page with a link on it that
opens a pop-up window, whereupon you'll see a test link to google.
Please go to http://barelybad.com/map_test.htm.

Please understand that I am nearly illiterate in Javascript. I can
follow directions, and I can adapt within reason, but I really will
need some pretty detailed instructions as to what goes where in which
HTML page.

Thanks again for your time.


Using pop-ups like this is not liked much, better to use a normal menu
system. But anyhow...

The following script checks to see that the opener is not closed. If it
isn't it must be open, so its location.href is set to the value passed
to the function. If the opener is closed, the pop-up just closes.

In the HTML source for your popup, add the following in the head:
<script type="text/javascript">

function changeOpenerHref(Href)
{
if (opener && !opener.closed){ // Make sure opener is open
opener.location.href = Href; // Change the href
}
window.close(); // Close the popup
}
</script>
To call the function, the href of the A element is used as a URL to pass
to the function using an onclick. This means that browsers that show
the href as a tooltip or in the status bar can still do so.

Change the link in the document body:
<a href="http://www.google.com"
onclick="changeOpenerHref(this.href);">Google.com</a>

<a href="http://www.apple.com"
onclick="changeOpenerHref(this.href);">Apple.com</a>

<!-- Add more ... -->

You can add lots of links and use the same function call each time.
--
Rob
Oct 24 '05 #2
RobG said the following on 10/24/2005 12:44 AM:
Jo******@gmail.com wrote:
Hello, all, and TIA for any help you can offer. I've searched the
Internet for answers and have finally come here.

I've created a page (several, actually) with a link that opens a pop-up
window. It's a pop-up window in the sense that it's smaller than the
man page and is intended to be viewed and then closed.

The problem is that if I include a link on that pop-up window HTML
page, when the link is clicked the new page opens IN the pop-up window,
which is not at all what I want. I want the pop-up window and the
window it came from to be closed out altogether first so that the new
page, the I link to from the pop-up window, opens in the user's default
browser view and the original pages are "released."

You can see a sample of the originating page with a link on it that
opens a pop-up window, whereupon you'll see a test link to google.
Please go to http://barelybad.com/map_test.htm.

Please understand that I am nearly illiterate in Javascript. I can
follow directions, and I can adapt within reason, but I really will
need some pretty detailed instructions as to what goes where in which
HTML page.

Thanks again for your time.

Using pop-ups like this is not liked much, better to use a normal menu
system. But anyhow...

The following script checks to see that the opener is not closed. If it
isn't it must be open, so its location.href is set to the value passed
to the function. If the opener is closed, the pop-up just closes.


That seems to be anti-user friendly, with the popup issue aside. Only
close the popup after the new URL has been addressed. If the opener is
closed, then open a new window.
In the HTML source for your popup, add the following in the head:
<script type="text/javascript">

function changeOpenerHref(Href)
{
if (opener && !opener.closed){ // Make sure opener is open
opener.location.href = Href; // Change the href
}
else{
window.open(Href)
}
window.close(); // Close the popup
}
</script>


--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 24 '05 #3
Thank you to RobG and Randy Webb for your help. The solution I
crafted based on your advice isn't ideal, but it's good enough.

Oct 26 '05 #4

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

Similar topics

12
by: relaxedrob | last post by:
Hi All! I have a page with with the following style information: <link rel="stylesheet" type="text/css" href="/eEmployment/eTech.css" /> <style type="text/css"> DIV.Application {...
2
by: John Smith | last post by:
I have more than 4,000 pieces of email in my Yahoo account. I would like to write a program to download them all. In order to write such a program, I need to know a few things. 1. After I fill...
145
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two...
4
by: trint | last post by:
Ok, I received info that this will work as a means of removing the border around a window that I create (which also loads an aspx file) in the firing file (aspx using javascript): OpenWindow =...
4
by: MrMike | last post by:
Hi. I have a hyperlink control (lnkViewLogData) which is assigned the following attribute when the page loads... Me.lnkViewLogData.Attributes.Add("onClick", _ ...
1
by: pbd22 | last post by:
Hi all. I am using styles to lock down the GUI until the user enters some info in a CSS/DIV pop box. If the user does now scroll before he clicks, the pop box is centered and the background...
0
by: oopaevah | last post by:
Hi, I have a set of valid xhtml pages that a third party web site is integrating with via an <iframein his own page. This retains his own branding template in the header and footer, with the...
6
by: mistral | last post by:
what is correct way open a PDF document in new window use hyperlink? I want show images thumbnails linked with PDF files, when click on thumbnail, PDF will be opened in new window. Some of PDF...
3
by: Ravigandha | last post by:
Hi every one. I am developing a online movie tickets website. And im struck at this point. I have a link when on clicking the link a pop window opens where in that how to display all the check...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.