473,811 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE7 problem when using popups

27 New Member
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>
Mar 10 '07 #1
22 6779
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN - The Scripts.

Set focus to the popup window.
Mar 12 '07 #2
alejandro
27 New Member
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.
Mar 12 '07 #3
alejandro
27 New Member
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.   <head>
  3.     <script language='javascript'>
  4.       window.onload = function (){ window.document.getElementById('inputThing').focus(); };
  5.       function popup(){
  6.         var newWindow = window.open('popup.html','','width=200,height=200');
  7.         newWindow.focus(); // This will execute, but afterwards the window that executes
  8.                            // it will reload and come on top of the popup window
  9.       }
  10.     </script>
  11.   </head>
  12.   <body>
  13.     <a href='popup.html' onclick="popup();">Click Me</a>
  14.     <input id='inputThing' type='text'></input>
  15.   </body>
  16. </html>
  17.  
Just trying out the [ code][ /code] thingy :D
Mar 12 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
If you want to avoid a reload of the page, put "return false;" after window.open.
Mar 12 '07 #5
alejandro
27 New Member
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
Mar 12 '07 #6
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.
Mar 12 '07 #7
alejandro
27 New Member
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).
Mar 12 '07 #8
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:
Expand|Select|Wrap|Line Numbers
  1. window.opener.window.location.reload()
These are only suggestions. See if they work.
Mar 12 '07 #9
iam_clint
1,208 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.   <head>
  3.     <script language='javascript'>
  4.    window.onload = function (){ window.document.getElementById('inputThing').focus  (); };
  5.       function popup(){
  6.         var newWindow = window.open('popup.html','','width=200,height=200'  );
  7.         window.setTimeout("newWindow.focus()", 2000); // This will execute, but afterwards the window that executes
  8.                            // it will reload and come on top of the popup window
  9.       }
  10.     </script>
  11.   </head>
  12.   <body>
  13.     <a href='popup.html' onclick="popup();">Click Me</a>
  14.     <input id='inputThing' type='text'></input>
  15.   </body>
  16. </html>
  17.  
try this
Mar 12 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2875
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
52
4443
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...
2
2325
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...
3
1660
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
2
1793
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.
1
2358
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
3
1945
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...
4
1527
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
7
27508
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):
2
2108
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'); } // -->
0
9730
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, 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...
0
9605
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,...
0
10651
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
agi2029
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...
1
7671
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
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();...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
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

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.