Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) Easy way to change “target” label fo current window?

  • Easy way to change “target” label fo current window?

    Posted by Bret Williams on May 9, 2005 at 4:51 pm

    Is there a simple way to change the target name of a curent window. I know I can open a new window and give it a name so that I can have other content open in that particular window, but within the new window, I’d like to have some links that open back up in the previous window, but the previous window doesn’t have a name. Any way to make that happen?

    Bret Williams replied 19 years, 8 months ago 2 Members · 10 Replies
  • 10 Replies
  • Curtis Thompson

    May 9, 2005 at 5:01 pm

    hello…

    if you’re trying to change the url of the window that opened the new windows (from the new windows), then you can either use “opener” – so like opener.location.href = ‘whatever’;

    sitruc

  • Bret Williams

    May 9, 2005 at 10:09 pm

    No, I can rename the source (opener) windows the first time someone visits the site. So I guess that would mean putting some code on every page.

    I want to be able to open a window, and the links in that window open back in the previous window. Sounds like what you have is the best thing, since I only have 2 sections that do this.

    Where would that code go, in the tag?

  • Curtis Thompson

    May 9, 2005 at 10:25 pm

    hello…

    ya – in the popup window, make the href link something like:

    <A HREF=javascript:opener.location.href=’something'”>link</A>

    and then something can be whatever you want it to be url wise – even more robust is a nice window closer as well:

    <A HREF=javascript:changeParent(‘something’)”>link</A>

    and then have a js function with that name:

    function changeParent (url) {
        opener.location.href = url;
        self.close();
    }
    

    and then it will change the parent to the url and close itself in one click…

    sitruc

  • Bret Williams

    May 9, 2005 at 10:38 pm

    If something is the name of the target window, and link is the link text, where does the actual file path go?

  • Curtis Thompson

    May 9, 2005 at 10:47 pm

    hello…

    no – sorry…”something” is the url. you reference the window that opened the current window via the opener modifier in opener.location.href…javascript stores the window that opened a window (via javascript) in that parameter…

    sitruc

  • Bret Williams

    May 9, 2005 at 10:54 pm

    Can I assume you messed up the quotes in the previous post? That’s what’s got me stumped here now…

  • Curtis Thompson

    May 9, 2005 at 11:04 pm

    hello…

    let’s just avoid the runaround – here’s an example of what i’m talking about…

    https://sitruc.com/cow/parent_change/page.html

    is that what you had in mind?

    sitruc

  • Bret Williams

    May 9, 2005 at 11:29 pm

    Thanks as always! Finally got it. I was trying to figure out syntax inbetween your emails. You were missing a double quote. But I also had added the script bit into the wrong .js file. So even when I got the syntax right it was just dead. User error of course.

    So I’ve got a test running hownet.lunarpages.net/store/wirelesswaysretail.php

    If you click on the “read” link on the right, it opens a window to read the book. Then if you click on the “wireless ways” title link, it should close and go back. Even if you’ve surfed around in the main window. That’s exactly what I was trying to do.

    We were going to opt for a flashpaper version of this book, but we opted for this more laborious version. 🙂 It’s still a work in progress. I’m just working on the navigation and cutting and pasting from his old, 6 year old site, and using pointless photos as placeholders and stuff.

    There’s a lot of crazy includes, iframes, and now little bits of javascript going on.

  • Curtis Thompson

    May 10, 2005 at 12:26 am

    cool – glad it worked! sorry for the typo…that’s not much help… :-/

  • Bret Williams

    May 10, 2005 at 12:31 am

    I figured it out, but was second guessing myself because I had linked to the wrong js file! Doh.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy