/    Sign up×
Community /Pin to ProfileBookmark

avoid open same window twice

I have a link on a page which opens up a new page, however, every time it is clicked, a new page is opened. 10clicks=10new windows of same page

is there a way that i can check whether this page is already opened in new window, if yes, just bring this window up, if no, open it?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 04.2006 — No need to check -- just name each window using the same valid name and they will re-use the first window opened:

var winPtr = window.open(url, name, features);
Copy linkTweet thisAlerts:
@ssffccauthorJun 05.2006 — thx phpnovice, problem solved, I also found another way of doing it: give it a name instead of using "_blank" in the target field
Copy linkTweet thisAlerts:
@ssffccauthorJun 05.2006 — one more thing, is it possible to bring the existing page to the front?

I found that this can be ahieved by ".focus()", but i dont know how to implement it to my code:

[CODE]<a href="Gallery.html" target="galleryWindow">-Image Gallery-</a>[/CODE]

please help
Copy linkTweet thisAlerts:
@phpnoviceJun 05.2006 — thx phpnovice, problem solved, I also found another way of doing it: give it a name instead of using "_blank" in the target field[/QUOTE]
Duh! That is not "another way" -- that is exactly what I said! :rolleyes:
×

Success!

Help @ssffcc 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 5.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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