detect pop-up blocker - different

This is a discussion on "detect pop-up blocker - different" within the JavaScript Forum section. This forum, and the thread "detect pop-up blocker - different are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 22nd, 2005, 10:30
New Member
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
detect pop-up blocker - different

Hello,

I have a web site I am developing. The web page has a photography gallery portfolio on it with thumbnails. When the thumbnail are clicked on, they open in a new window. I would like to add to the javascript a detection and alert that notifies the user that the window did not open due to a popup blocker. Could somebody please help me with this, I can't figure out how to do it on my own.

Here is the original javascript for the window opener script:

<script language="JavaScript" type="text/JavaScript">
<!--
function viewPic(img)
{
picfile = new Image();
picfile.src =(img);
fileCheck(img);
}

function fileCheck(img)
{
if( (picfile.width!=0) && (picfile.height!=0) )
{
makeWindow(img);
}
else
{
funzione="fileCheck('"+img+"')";
intervallo=setTimeout(funzione,10);
}
}

function makeWindow(img)
{
ht = picfile.height;
wd = picfile.width;

var args= "height=" + ht + ",innerHeight=" + ht;
args += ",width=" + wd + ",innerWidth=" + wd;
if (window.screen)
{
var avht = screen.availHeight;
var avwd = screen.availWidth;
var xcen = (avwd - wd) / 2;
var ycen = (avht - ht) / 2;
args += ",left=" + xcen + ",screenX=" + xcen;
args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=no";
}

popwin=window.open("","_blank",args)
popwin.document.open()
popwin.document.write('<html><head><title>'+img+'</title></head><body bgcolor=black scroll=no topmargin=0 leftmargin=0 rightmargin=0 bottomargin=0 marginheight=0 marginwidth=0><div style="position: absolute; top:0px;left:0px">[img]'+img+'[/img]</div></body></html>')
popwin.document.close()

}
//-->
</script>

Now, I tried to modify that script, here is what I added to it:

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

if (popwin==null || typeof(popwin)=="undefined")
{
alert("window failed to open");
}
else
{
popwin.document.write('<html><head><title>'+img+'</title></head><body bgcolor=black scroll=no topmargin=0 leftmargin=0 rightmargin=0 bottomargin=0 marginheight=0 marginwidth=0><div style="position: absolute; top:0px;left:0px">[img]'+img+'[/img]</div></body></html>')
popwin.document.close()
}
}
--------

If somebody would be able to help me, it would be greatly appreciated. Thank you so much.
Reply With Quote

Reply

Tags
detect, popup, blocker, different

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Popup Name Detect RobinDeanDotCom JavaScript Forum 0 Feb 24th, 2007 22:35
Script to detect flash? fezunit JavaScript Forum 5 Jan 28th, 2007 12:18
Detect IE Totti JavaScript Forum 4 Dec 6th, 2006 00:48
Possible to detect which stylesheet in use? mar2195 JavaScript Forum 9 Nov 25th, 2006 11:43
Detect whether connection to external url is possible simonneaves Classic ASP 3 Oct 24th, 2005 13:12


All times are GMT. The time now is 04:35.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43