Forum Moderators: phranque

Message Too Old, No Replies

non-javascript popup window

non-javascript popup window

         

gibbittynyc

3:35 pm on May 7, 2003 (gmt 0)

10+ Year Member



Is there a way in which to code a popup window without using javascript?

BlobFisk

3:41 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Stating the obvious:

You could use target="_blank" on your anchors... but then you won't have control over the new windows size etc. (unless you do this with JavaScript in the new window).

gibbittynyc

3:51 pm on May 7, 2003 (gmt 0)

10+ Year Member



Yes this works and you can actually code the window size in the string. My issue is creating a redirect off the new popup to another url. Can this be done without using JavaScript as well? Thanks for the help.

BlobFisk

4:01 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about using the META refresh tag to do this?

gibbittynyc

4:36 pm on May 7, 2003 (gmt 0)

10+ Year Member



thank you very much. this has done the trick very nicely.

BlobFisk

5:03 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My pleasure, gibbittynyc.

How did you put the window size in the (url?) string? I've never seen this done and I'd be interested in seeing your code.

TIA

gibbittynyc

5:10 pm on May 7, 2003 (gmt 0)

10+ Year Member



<a href="http://your url.html" target="_blank" onclick="if (window.open) {Console=window.open(this.href,this.target,'toolbar =yes,location =no,directories =no,status =no,menubar =no,scrollbars =no,resizable =yes,width =400,height =300'); return false;} else { return true</a>

Sinner_G

5:15 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Now maybe I'm wrong (don't think so though), but wasn't the point to NOT use JS? AFAIK, window.open is JS.

gibbittynyc

5:19 pm on May 7, 2003 (gmt 0)

10+ Year Member



yes you are right, but when used inside of html this way it wont break on non-javascript enabled browsers.

Donna_McG

3:23 pm on May 28, 2003 (gmt 0)

10+ Year Member



Maybe I'm missing something, but where does the <a tag end?

BlobFisk

3:34 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Donna_McG!

You're right there is no closing > on the anchor tag.


but when used inside of html this way it wont break on non-javascript enabled browsers.

I'm not too sure about this. It is javascript and won't run if the browser has javascript disabled...

korkus2000

3:36 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



BlobFisk I think they mean that if you don't have javascript enabled you can still go to the href="location". Putting the code directly in the onlclick or calling a function is really personal preference.

congrats BTW on reaching 1000 posts.

BlobFisk

3:59 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Of course, silly me and apologies gibbittynyc! I must remember to keep repeating "read the post properly, read the post properly"!

>congrats BTW on reaching 1000 posts.

Cheers!

[edited by: BlobFisk at 4:00 pm (utc) on May 28, 2003]

Donna_McG

3:59 pm on May 28, 2003 (gmt 0)

10+ Year Member



Seems to work if you add a semi-colon after true, close the curly bracket, quote, and angle bracket. :)

Another dilemma:
How can you get the popup to appear "dead-center" in the browser window? I have used "left=?" "top=?" and "screenx=?" "screeny=?" to try to move it around in the page with little satisfaction.

BlobFisk

4:02 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do this using javascript by calculating the available width of the browser, half it and take away half the width of your popup window. Do this again for the height and you have your top and left values.

Donna_McG

4:28 pm on May 28, 2003 (gmt 0)

10+ Year Member



OK -- now I'm LOL -- wasn't the whole point of this thing to NOT USE javascript?

BlobFisk

4:37 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think that there is any way of getting a popup to position itself in the centre without using JavaScript. You have the top and left (xpos, ypos) attributes, but in the variable environment that is your users computers, that won't work.