473,805 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Popups sometimes get blocked by IE

I'm working on a site for a friend. I've found some image popup code
that does what I want (borderless, close on exit) but for some reason
I occasionally get the "popup blocked" information bar in IE6.

Any suggestions?
Here is an example page, js code below:

http://www.aquariusyachting.co.uk/exterior.htm
var popwin='';

function viewPic(img)
{
picfile = new Image();
picfile.src =(img);
fileCheck(img);
}
function fileCheck(img)
{
if( (picfile.width! =0) && (picfile.height !=0) )
{
checkExisting(i mg);
}
else
{
funzione="fileC heck('"+img+"') ";
intervallo=setT imeout(funzione ,50);
}
}
function checkExisting(i mg)
{
if (popwin.locatio n && !popwin.closed)
{
popwin.close();
makeWindow(img)
//popwin.location .href = img; needs a tidy here, but it works NM
// popwin.focus();
}
else {makeWindow(img )}
}
function makeWindow(img)
{
ht = picfile.height;
wd = picfile.width;

var args= "height=" + ht + ",innerHeig ht=" + ht;
args += ",width=" + wd + ",innerWidt h=" + wd;

popwin=window.o pen("","_blank" ,args)
popwin.document .open()

popwin.document .write('<html>< head><title>'+i mg+'</title></head><body
bgcolor=white scroll=no topmargin=0 leftmargin=0 rightmargin=0
bottomargin=0 marginheight=0 marginwidth=0> <div style="position :
absolute; top:0px;left:0p x"><a href="javascrip t:window.close( )"> <img
src="'+img+'" width="'+wd+'" height="'+ht+'"
border="0"></a></div></body></html>')
popwin.document .close()
}
function tidy() {
if (popwin.locatio n && !popwin.closed) {
popwin.close(); }
}

// Based on JavaScript provided by Peter Curtis at www.pcurtis.com &
// http://www.therotunda.net/code/autos...up-window.html -->

--
Nigel M
Jul 23 '05 #1
7 1697
VK
If I read your Ezop language properly (I may not), then "a friend" is
"the target audience", so the question should be refrased as:

"For the visitors using IE 6 the number of shown popup ads is lesser
than the number of the registered visitors. What is the problem?"

The problem is that starting Windows XP SP2 popup blocker is finally
activated by default. So in the incoming times you need either to place
a text begging your visitors to allow popups (with instructions of
course), or (much more reliable) to move one on other alernatives
(popping up iframes or div's).

Jul 23 '05 #2
On 3 Jul 2005 01:57:07 -0700, VK wrote:
If I read your Ezop language properly (I may not), then "a friend" is
"the target audience", so the question should be refrased as:

"For the visitors using IE 6 the number of shown popup ads is lesser
than the number of the registered visitors. What is the problem?"


I'm sorry, I don't know what you mean.

The problem is that sometimes, an apparently random image will fail to
popup, and invoke the "popup blocked" information bar.
--
Nigel M
Jul 23 '05 #3
VK
> The problem is that sometimes, an apparently random image will fail to
popup, and invoke the "popup blocked" information bar.


OK, you may try this rather old script I used to use (I just cleaned it
of the NN4 stuff). Please mark the conventional way for image
buffering/error check. Your way is "too curly" to be reliable.

<script type="text/javascript">

var myPopup = null;
var myImage = null;

function init() {
myImage = new Image();
myImage.onload = showPopUp;
myImage.onerror = handleError;
document.getEle mentById('Buffe r').insertBefor e(myImage,null) ;
getImage('foo.j pg');
}

function getImage(imgURL ) {
myImage.src = imgURL;
}

function showPopUp() {
/* Image is buffered successfully */
/* It's time to display it */
var html = '<html><head><t itle>Click on image to close it</title>';
html+= '<style type="text/css">body {margin: 0px 0px}</style>';
html+= '</head><body>';
html+= '<img src="'+myImage. src+'" width='+myImage .width;
html+= ' height='+myImag e.height;
html+= ' onmouseup="self .close()">';
html+= '</body></html>';
if ((myPopup != null)&&(!myPopu p.closed)) {myPopup.close( );}
var winParms = 'width='+myImag e.width+',heigh t='+myImage.hei ght;
myPopup = window.open('', '_blank',winPar ms);
with (myPopup.docume nt) {
open('text/html','replace' );
write(html);
close();
}
}

function handleError() {
/* Image cannot be obtained from the server */
/* Up to you: what to do */
}

window.onload = init;
</script>

And somewhere on your page:
....
<div id="Buffer" style="visibili ty: hidden">&nbsp;</div>
....

P.S. You cannot create popups lesser than 100px in width or height. An
attempt to create such pupup will trig security exception. How it will
be reacted is up to the browser. IE for example simply opens a default
size window. If you have picture lesser than 100px in any dimention,
you need to adjust your script.

Jul 23 '05 #4
On 5 Jul 2005 00:52:22 -0700, VK wrote:
OK, you may try this rather old script I used to use (I just cleaned it
of the NN4 stuff). Please mark the conventional way for image
buffering/error check. Your way is "too curly" to be reliable.


Many thanks for this, it certainly works when the page loads. Can you
suggest how I could modify it to pop up the image window when a
thumbnail is clicked?
--
Nigel M
Jul 23 '05 #5
VK
> how I could modify it to pop up the image window
when a thumbnail is clicked?


(1) In function init() comment out
// getImage('foo.j pg');

(2) Function getImage() changed as follows:
function getImage(evt, url) {
(evt.preventDef ault) ? evt.preventDefa ult() : evt.returnValue = false;
myImage.src = url;
}

(3) In your page:
<a href="pic_1_big .jpg" onclick="getIma ge(event, this.href)">
<img src="pic1_thumb .gif" width="60" height="60" border="0">
</a>

But if you're doing thumbnail viewer, why do you need a buffering
anyway?? It's going to be very confusing for users, because they will
wondering if a link is dead or they have to wait for something. Just
open popup immediately upon click.

Jul 23 '05 #6
On 5 Jul 2005 04:13:35 -0700, VK wrote:
But if you're doing thumbnail viewer, why do you need a buffering
anyway?


I don't know if I do need buffering, but I pre-load the images as 1x1
pixels so the popups happen faster. Is there a better way?
--
Nigel M
Jul 23 '05 #7
VK
> I pre-load the images as 1x1 pixels
so the popups happen faster.
Is there a better way?


Pre-load may be good in such situation only if user has a high-speed
connection plus (s)he waits until your page is fully loaded (with all
"big images" buffered). If user has a rather slow connection and/or
user starts to click thumbnails before all big images are fully loaded,
it will produce a big mess in your script and bit irritation for user.
IMHO you should follow the common "browsing experience". Everyone's
learned that pictures in the browser never appear "right away", but
displayed part-by-part upon arrival. So it would be totally normal and
expected to open a popup for the big picture right upon the click on
the thumbnail, and let it be loading in view of the user.

If you care to make the waiting period the least boring for users, you
may convert all your GIF's into the *interlaced* format, and all your
JPG's into *progressive* format.

Jul 23 '05 #8

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

Similar topics

6
4540
by: Stephane Dalpe | last post by:
Hi all, I just want to know why when I'm installing jdk sometimes ask me to reboot and sometimes he don't. As part of our installation, we launch the jdk installation if it's not already installed, so it's important to know when the user will be asked to reboot. Thanks
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...
1
1393
by: Jim Mitchell | last post by:
I use pop ups as part of my application.... Is there any way to detect if popups are blocked for my site and ... 1) Let the user know to allow popups for this site? Thanks in advance, Jim
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
0
1142
by: heathy | last post by:
A puzzle... hmmm, we have firewall software on our laptops so that when the laptop is in 'remote mode', i.e. out of the office, internet explorer is only allowed to go to our company remote working site, and not browse the internet at will... this is fine except when they are at a wireless hotspot etc. where a the browser is redirected to a payment screen (which is then blocked by the firewall). My solution to this was to write an...
4
3281
by: dd | last post by:
I have a scenario where my popups are being blocked by IE6+ and Firefox. The problem is that although the popup is a direct result of the user clicking on the link (meaning that they WANT the popup), when it comes to opening it, I'm doing it via a JavaScript function and by the time the popup is opened the browser doesn't know it was as a result of that click. The link between click and popup open attempt is broken. The reason for this...
1
2358
by: Moe Sisko | last post by:
Using : ASP.NET 2.0, IE 7. This is a strange problem with popups not working in IE to remote sites, even though popups are allowed in IE. To reproduce, create web site with two pages, Default.aspx and Default2.aspx. Note that the example is a deliberately simplified example - just used to reproduce the problem, and not meant to be very useful. Default.aspx - add button1. In codebehind, hookup click event :
0
9718
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
9596
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
10363
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...
1
10369
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7649
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
6876
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
5544
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4327
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
2
3847
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.