SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    POPUP WITHOUT ANYTHING IN <HEAD>

    I need to make an automatic popup window for my site but i dont want to place any code in the <HEAD></HEAD> tags.
    Is this even possible?

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am confused as to what you mean

    care to explain more?
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup.

    HTML Code:
    <body onload="javascript:window.open('http://www.example.com');">
    Should work

    -Sam
    Sam Hastings

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course, remembering to delete the space between java and script

    -Sam
    Sam Hastings

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, that worked
    Anyway of making it popup behind the existing window or making custom size or anything this way?

  6. #6
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change height and width like this:
    window.open('html.html','winName','height=200,width=200');

    Not sure but u could try this to make it pop up behind:
    <body onload="var win=window.open('open.html','winName','height=200,width=200');win.blur();">
    Yup it seems to work for me!

  7. #7
    SitePoint Zealot Arkkimaagi's Avatar
    Join Date
    Mar 2002
    Location
    Lappeenranta, Finland
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Popunders are evil, luckily my browser kills them. I'd advise not to use them.

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Arkkimaagi
    Popunders are evil, luckily my browser kills them. I'd advise not to use them.
    IMO they're fine as long as you can see the message somewhere else. Dell's special offers on their site is a good example. It pops up when you first get to the site, but you can see the special offers in other places as well

  9. #9
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Devilware.net
    HTML Code:
    <body onload="javascript:window.open('http://www.example.com');">
    onload is by its very nature a javascript event, so the use of javascript: is entirely redundant.

    ---

    Quote Originally Posted by Poop_Shoot
    <body onload="var win=window.open('open.html','winName','height=200,width=200');win.blur();">
    Yup it seems to work for me!
    It would be much, *much* better to move the guts of the popup script into an embedded or external javascript, wrap it in a function and simply call the function in the onload event.

    Using inline javascript in your markup like that is only making extra work for yourself and anyone else may work on or maintain the site.

    ---

    Ev!, if you *really* feel you have to use an automatic popup, then don't rely on it as the only way to trigger the new window.
    Offer a link/button that will trigger the popup for those of us who have all automatic popups prevented by default.

    It's far from ideal (or popular) to use popups to house essential site content or navigation.
    Use them if you want, but be aware of the problems and potential problems that come with them.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  10. #10
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Bill Posters
    onload is by its very nature a javascript event, so the use of java script: is entirely redundant.
    Sorry, it's a force of habit. My first HTML book told me to do it (albeit about 5 years ago)

    -Sam
    Sam Hastings

  11. #11
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    She asked for it on onload I never said that inline javascript! Or anything inline for that matter is a good idea! I was just responding to the question!
    Last edited by Poop_Shoot; Aug 24, 2003 at 06:42.

  12. #12
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No need to go on the defensive, poop_shoot. We're all aiming for the same thing.

    But, just out of curiosity, why did you offer/suggest a method that you thought wasn't a good idea?
    Why not show the method as you presumably would have done it yourself?

    Like I say, I'm not having a pop at you, just curious.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  13. #13
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well Ev Said!

    I need to make an automatic popup window for my site but i dont want to place any code in the <HEAD></HEAD> tags.
    Without any code in the head tag I suppose that I could have done an extenal JS then link to it in the body calling it with a window.onload=function()! but generaly when trying to answer someones post I try to stick to what the asked for!

  14. #14
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fair enough. I'd still be inclined to mention the embedded or external method and explain how and why it is better, but I totally appreciate where you're coming from.

    Fwiw, by 'inline' javascript I was only referring to placing the guts of a javascript in the markup.

    I think that <body onload="popupFunction();"> is still acceptable enough to keep even the most anooyingly pedantic of members (such as myself) quiet.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  15. #15
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This brings up a question is a bookmarklet concidered inline javascript!

    Sorry Bill if I sounded angry in my post you caught me b4 my morning coffee!

  16. #16
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If that's how you are *before* your morning caffeine hit, then I'll be even more inclined to steer clear of you *afterwards*.


    Fwiw, I would imagine that a bookmarklet woudn't be considered as inline javascript as it's not contained inside the markup itself, whichi imho, would be the deciding factor.
    If the ultimate aim is separate markup, code and styling, then you can't get much better than javascript bookmarklets. They are so separate that they aren't even contained anywhere within the site's own files.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •