NameSilo

New Window, No JS

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

esf989

New Member
Impact
0
Currently my website is utilizing some JavaScript to (onclick) open a new window, and automatically size it to an image, and auto-close when it is no longer the active window (ie, click elsewhere).

However, I want to rid my HTML 4.01 of any Javascript, simply because a significant portion of my viewing audience has disabled all JS.

Is there a way to auto-size a new window around an image through something besides JS? PHP? ASP? CSS even? I'm afraid I don't know enough about the capabilities of these languages to know which to learn more about first.

Many thanks,



Raw JS script below for reference if necessary::

<script type="text/javascript">
PositionX = 25;
PositionY = 25;

defaultWidth = 1050;
defaultHeight = 850;

var AutoClose = true;

if (4<=parseInt(navigator.appVersion.charAt(0))){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
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=(navigator.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].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["FalkPic"].width;');writeln('window.innerHeight=document.images["FalkPic"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</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="FalkPic" src='+imageURL+' style="display:block" alt=""></body></html>');
close();
}}
</SCRIPT>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
I remember using the above coding before and if I recall correctly, it was created by etLux. I think it's very unlikely you'll find anything besides that, especially if the range of languages you are willing to use is so narrow. Welcome to the forums, by the way!
:D
 
0
•••
Well, my range of languages is only limited by what someone might suggest. I'd love to move my JavaScript to something more "server-side" so people won't have the option of disabling the code.
 
0
•••
why?? just allow both ways
 
0
•••
@jstep:
Well, I know one way... the Javascript enabled way.

I suppose that's the essense of my question, what is the other way? What is the other half of your "both"?
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back