SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    to popups from search engines

    Hi folks,
    I have two documents - a.html and b.html. Both pages have a link that opens (the same) popup window - c.html. At the bottom of the popup is a 'close' button, of course.

    Now the situation may arise that the popup is accessed directly, say from a search engine. In that case I want there to appear an additional link or button on c.html (I assume using 'writeln') with a link to the main site (as well as the 'close' button).

    I don't want this link to appear if the popup is accessed from the main site - in that case I want visitors to just be able to close the window and be back where they were before they opened it.

    I'm getting confused with the parent property of framesets. No idea what to do with popups. Can someone point me in the right direction please? Any help would be appreciated.
    Thanks
    whataday

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm, this should work
    Code:
    if ( !top.opener )
    {
        document.write('<a href="index.htm">Home Page</a> |');
    }
    document.write('<a href="javascript:window.close();">Close Window</a>');
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks beetle, that's great. I changed it a little so that the main page opens in a new window using window.open. Seems to work ok:


    if ( !top.opener )
    {
    document.write("<_"javascript:window.open('main.html','mainpage','toolbar=yes,directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,personalbar=yes,fullscreen=yes');_">Go to main page | </a>");
    }
    document.write("<a href='javascript:window.close();'>Close window</a>");
    Thanks
    whataday


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
  •