SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict zeeb44's Avatar
    Join Date
    Apr 2011
    Location
    Greenville, SC
    Posts
    202
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open link in new sized window

    Is there a way to open a link in a new window. That is presized? not a new tab, but a completely new window that would be set to like 600x800 for example?

    and at the same time pass this? The W3C Markup Validation Service
    Personal Portfolio - Zeeb44
    IT Manager for - Family Dental Health

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You could do this with unobtrusive javascript. By progressively enhancing existing content, you'll pass validation and also cater for users without JavaScript.

    So for example, let's say you have a link:
    Code:
    <a href="http://example.com" id="external-link">Link to example.com</a>
    You could add a click-handler to the link that calls window.open()

    e.g. of the window.open call
    Code JavaScript:
    //I'm assuming here that you've defined "theHREF" to be the href of the "external-link" in the click handler function.
    window.open(theHREF, "NewWindowDescriptiveName", "width=800,height=600");

    There are a bunch of other options you can set alongside width and height, check out the MDN documentation
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Addict zeeb44's Avatar
    Join Date
    Apr 2011
    Location
    Greenville, SC
    Posts
    202
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I appreciate this. I will take a look. Thanks.
    Personal Portfolio - Zeeb44
    IT Manager for - Family Dental Health


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
  •