Hey everyone, I'm currently working on a php project that started about 3 years ago (meaning, it's already quite large.).
It uses quite a lot of pupups that seem to work great in all browsers... or used to until IE 7 came along.
The problem is, if I have a link that generates a popup but also relocates the page where the link was clicked, the main page will come on top of the popup when it starts loading (this does not occur in any other browser other than IE 7.). This occurs if the page has an onload event that sets focus somewhere in the page.
I will provide an over-simplified example, try it out in FF, IE 6, and IE 7 to see what I mean:
content of popup.html:
<html>
<head>
<script language='javas cript'>
window.onload = function (){ window.document .getElementById ('inputThing'). focus(); };
</script>
</head>
<body>
<a href='popup.htm l' onclick="window .open('popup.ht ml','','width=2 00,height=200') ;">Click Me</a>
<input id='inputThing' type='text'></input>
</body>
</html>
22 6779 acoder 16,027
Recognized Expert Moderator MVP
Welcome to TSDN - The Scripts.
Set focus to the popup window.
thanks for the welcome.
I already tried that, but it will not work: the main window will give the focus to the popup, however, afterwards it will start loading the page in the href and come on top of the popup.
-
<html>
-
<head>
-
<script language='javascript'>
-
window.onload = function (){ window.document.getElementById('inputThing').focus(); };
-
function popup(){
-
var newWindow = window.open('popup.html','','width=200,height=200');
-
newWindow.focus(); // This will execute, but afterwards the window that executes
-
// it will reload and come on top of the popup window
-
}
-
</script>
-
</head>
-
<body>
-
<a href='popup.html' onclick="popup();">Click Me</a>
-
<input id='inputThing' type='text'></input>
-
</body>
-
</html>
-
Just trying out the [ code][ /code] thingy :D
acoder 16,027
Recognized Expert Moderator MVP
If you want to avoid a reload of the page, put "return false;" after window.open.
that's part of the problem, I don't want to avoid the reload. It's part of the specs, the popup should open and the window should relocate to a different location :S
Also, I don't think a return false would work, since the link has a href :P
acoder 16,027
Recognized Expert Moderator MVP
that's part of the problem, I don't want to avoid the reload. It's part of the specs, the popup should open and the window should relocate to a different location :S
Also, I don't think a return false would work, since the link has a href :P
A return false would work. It prevents the browser following the link.
Anyway, to work around your problem, call setTimeout to cause a delay. Then set focus to the popup.
acoder, thank you very much for all your help, I hate to be a pain.
The problem is, no matter what javascript I write in the main window, it will relocate to the href after executing it (so, even if I cause a delay and give focus to the popup, the main window will relocate after executing this code and come on top of the popup, only in IE7, of course).
acoder 16,027
Recognized Expert Moderator MVP
Well, one possibility is to give focus onload to the popup by passing a parameter to to the page, e.g. popup.html?win= popid where popid is the ref. to the popup. Use the location.search property ( link). I don't know if it will work, haven't tried it. Then use that to set focus to the popup after giving focus to the input element.
Another possibility is to let the popup perform the reloading by: - window.opener.window.location.reload()
These are only suggestions. See if they work.
iam_clint 1,208
Recognized Expert Top Contributor -
<html>
-
<head>
-
<script language='javascript'>
-
window.onload = function (){ window.document.getElementById('inputThing').focus (); };
-
function popup(){
-
var newWindow = window.open('popup.html','','width=200,height=200' );
-
window.setTimeout("newWindow.focus()", 2000); // This will execute, but afterwards the window that executes
-
// it will reload and come on top of the popup window
-
}
-
</script>
-
</head>
-
<body>
-
<a href='popup.html' onclick="popup();">Click Me</a>
-
<input id='inputThing' type='text'></input>
-
</body>
-
</html>
-
try this
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Art |
last post by:
NEWBIE ALERT!
Esteemed List Participants and Lurkers:
(System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
wxPythonWIN32-2.4.1.2-Py22.exe)
I'm having a lot of fun getting started with Python ... it is the most
elegant and graceful language I have ever used (Fortran, Cobol, Basic, many
assemblers, Forth, C, VB, etc.). I don't have the resources or the
|
by: Harlan Messinger |
last post by:
Can you help me figure out what to do about popups?
Sometimes we develop web applications where popups make very good sense for
precisely the same reasons they make sense in traditional locally-installed
application interfaces. I understand some people object, on grounds having
nothing to do with disabilities, to links that generate new browser windows.
I don't know what the basis of their objection is, but I wonder whether the
same...
|
by: malcolm |
last post by:
Hello,
We have a robust (.NET 1.1 c# winforms) client-server application that
utilizes many typed DataSets, typed DataTables and typed DataRows. Our
application is a series of windows and popup windows where you can
edit information and data, nothing out of the ordinary. I estimate we
have something like 50 to 100 tables and/or views in our database each
of which map to one strongly typed DataTable. Now we have some odd 20
to 30 typed...
|
by: PSERVE |
last post by:
Is the a way of preventing popups from other sites while your page is
loading?
--
Regards
Nik
http://www.itconsultancy.org
|
by: Tom Szabo |
last post by:
Hi,
>>IE in Windows XP Service Pack 2 has a popup blocker that blocks
unsolicited
>>popups
>>IE (other than Windows XP Service Pack 2) also has many add-ons (Google
toolbar,
>>Yahoo! toolbar, Norton Internet Security, etc) that block unsolicited
popups.
| |
by: dejausenet |
last post by:
I have firefox 1.0, running on winxp
Firefox blocks popups fine, but sometimes, for selected occassions
only, i would like to be able to have window popup; without enabling
whole domains, as other popups from same domain are not desired.
How can I selectively override the firefox popup blocker, without
opening up pop up from many ads from same domain.
Tx
|
by: Leah |
last post by:
I'm updating an app currently in Access 2000, which uses Outlook 2000
(sr1a) to send emails behind the scenes. Several issues have come up
since I've started work on this.
This office is moving to Office 2003, and the annoying security
prompts for Outlook automation are not wanted by the customer.
So, I started looking at CDO mail. Lots of stuff there, but nothing
works - in Access 2000. (Known bug, alternative is to use outlook...
|
by: ciprian.dosoftei |
last post by:
Hello,
I just finished a tutorial website regarding the development of DHTML
popups. The site features several examples with downloadable samples.
It also feature more complex effects like drop-down popups, fade
in/out, slide in etc.
The URL is: http://dhtmlpopups.webarticles.org/
I hope you will find the information useful. Any feedback is welcomed
|
by: fredo |
last post by:
I've studied Eric Meyer's pure css popups, version two:
http://meyerweb.com/eric/css/edge/popups/demo2.html
which pops up an image when I roll over a text link.
Now I want to pop up a large image when I roll over a thumbnail. I've
tried some things, but can't make it work. See here (Warning: adult
matter):
|
by: Plum Bob |
last post by:
Hi - I use a simple JS function to open popups on my site:
<script language="javascript">
<!--
var pathname;
function openit(pathname) {
newWindow = window.open(pathname, 'wndow1',
'resizable=yes,scrollbars=yes');
}
// -->
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |