/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Back Buttons

Hi all
I do hope someone can help me with a little JavaScript problem?
My web page ([B]Page 1[/B]) has a menu which takes the user to a new page using the target=_blank.
It is therefore opening in a new page ([B]Page 2[/B]) on a new instance of IE7. This is exactly what I wanted. But I also need the user to click on a “Back” button of some kind, which hopefully will take the user back to the first page ([B]Page 1[/B]) and hopefully close [B]Page 2[/B].
I have been experimenting with href=”javascript:history.back()” and so on, but the best I can get is it opens a new instance of [B]Page 1[/B] in place of [B]Page 2[/B]. This then leaves two instances of [B]Page 1[/B].
Obviously this is far from ideal so any thoughts or solutions even will be greatly appreciated.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 17.2007 — I think all you really want to do is close page 2 and focus page 1 (just in case).
<i>
</i>&lt;input type="button" value=" Close " onclick="window.close();opener.focus();"&gt;
×

Success!

Help @terrym spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...