Reputation: 285
As the topic says, Im looking for a way to redirect to another page, when i click a link in the iframe. i dont want just the iframe to redirect, but the whole window. is this possible?
preferrably in javascript or in asp.net if possible
EDIT: When i try the answers i get redirected to the source of the iframe, not to the source of the site the iframe lies on... Ill show you the code
function redirect() {
window.top.location.href = "./Nyheter.html";
}
As i dont want the code to be static, so that i can use it on many pages without changing the url, i want to do it this way, alt. get the url from db... but preferrably this way, Solution? Also, forgot to mention. The pages are not on the same domain, they are on different ones.. this could cause some problems.
Upvotes: 2
Views: 12502
Reputation: 5578
You cannot use the window.top.location if your frame and the top level page are on different domains. A similar answer.
Upvotes: 2
Reputation: 3614
You should see this question which is pretty much identical: Redirect parent window from an iframe action
I don't believe you can do it in ASP.net because this has to be done on the client side (ie. Javascript).
window.top.location.href = "http://site.com";
Upvotes: 0