Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > yet another Safari question... auto-sizing popup window not working

Reply
Thread Tools

yet another Safari question... auto-sizing popup window not working

 
 
Crunch Hardtack
Guest
Posts: n/a
 
      07-14-2005
Hi all, I'm not a programmer so please bear with me.
I got this script from codelifter.com and it works great in Firefox and
IE/PC, but Safari 1.3 doesn't do anything but open a blank window
titled "about:blank."
I'm on a Mac using Tiger 10.4.2.
Any help would be greatly appreciated!

Here's the script:

<script>

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var
optNN='scrollbars=no,width='+defaultWidth+',height ='+defaultHeight+',lef
t='+PositionX+',top='+PositionY;
var
optIE='scrollbars=no,width=150,height=100,left='+P ositionX+',top='+Posit
ionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN); }
if (isIE){imgWin=window.open('about:blank','',optIE); }
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</
style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if
(parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0; ');writeln('isIE=(navi
gator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if
(isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);
');
writeln('height=100-(document.body.clientHeight-document.images[0].heigh
t);');
writeln('window.resizeTo(width,height);}');writeln ('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('w
indow.innerHeight=document.images["George"].height;}}');
writeln('function
doTitle(){document.title="'+imageTitle+'";}');writ eln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no"
onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no"
onload="reSizeToImage();doTitle();self.focus()"
onblur="self.close()">');
writeln('<img name="George" src='+imageURL+'
style="display:block"></body></html>');
close();
}}

</script>
 
Reply With Quote
 
 
 
Reply

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Safari issue writing popup window justsee@gmail.com Javascript 0 06-06-2005 05:24 PM
Yet another book recommendation, but for someone who can program and yet does not the terminology well Berehem C Programming 4 04-28-2005 05:25 PM
ASPFileUpload Not working working using MAC Safari browser Foreman ASP General 5 01-25-2005 05:35 PM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments
 



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 44 45 46 47 48 49 50 51 52 53 54 55 56 57