/    Sign up×
Community /Pin to ProfileBookmark

Redirect Parent window from child

I have a pop up and when i click a button in the pop up i want the
parent page to redirect to a new url

This is what i have tried

window.opener.location.reload(default.asp)
widnow.opener.location.replace(default.asp)

What should it be thanks.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@lmf232sauthorAug 25.2004 — i got it

window.opener.location.href='Url'
Copy linkTweet thisAlerts:
@David_HarrisonAug 25.2004 — For future reference:

.reload() - takes no arguement, just refreshes the page.

.replace("URL") - replaces the current page with a different one, the back button cannot be used to get back to the previous page though.

.href="URL" - takes the user to a different page, just as if a link were clicked, the back button can be used to get back to that page.
Copy linkTweet thisAlerts:
@nitwitAug 25.2004 — Somewhat better reference ?:

[color=blue]window[[i]self/top[/i]].location.reload(true);[/color]

...most definately takes an argument (Boolean), ensures - and seems to work, generally - that reload is not from cache

[color=blue]location.replace([i]url[/i]);[/color]

...changes location, without adding item to browsing history

[color=blue]location = [i]url[/i];[/color]

...'href' property optional; because of its importance, the [b]Location[/b] object - btw it's [b]window[/b].location (not document) - can be written to directly.
Copy linkTweet thisAlerts:
@David_HarrisonAug 26.2004 — [i]Originally posted by nitwit [/i]

[B]ensures that reload is not from cache[/b][/quote]
I did not know that.

[i]Originally posted by nitwit [/i]

[B]changes location, without adding item to browsing history[/b][/quote]
It does add the item to the history, but it replaces the current page in the history. In other words, the back button will not take you back to the page that the location.replace was on, but instead the one before it.

[i]Originally posted by nitwit [/i]

[B]'href' property optional[/B][/QUOTE]
Web-sites "work" without a DOCTYPE but a DOCTYPE is still mandatory, the same thing goes here.
Copy linkTweet thisAlerts:
@nitwitAug 26.2004 — Good call on .replace(), I was typing & eating at the same time, bad idea...?

Web-sites "work" without a DOCTYPE but a DOCTYPE is still mandatory, the same thing goes here.[/QUOTE] Wrong, the Location object is [i]designed[/i] to take a (string) url...according to David Flanagan of O'Reilly 'rhino' book fame, this is the preferred technique. Neither is 'mandatory', however.
×

Success!

Help @lmf232s 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.28,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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