Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  104] [ 3]  / answers: 1 / hits: 83600  / 12 Years ago, tue, march 27, 2012, 12:00:00

I am working in a project where I have to redirect on Error Page in a particular scenario. For that I have created Error.aspx page. Right now I am using
window.top.location.href = ../Error.aspx and it generate http://localhost/app_web/Error.aspx
and its working fine except once (which shows Message http://xyz/ErrorPage.aspx' does not exist. ). So can anyone suggest which is the better option for this.



Thanks


More From » jquery

 Answers
11

top is better than parent if your intent is to framebust your page into the top level, because your page may be inside a frame that is itself inside a frame.



As for your relative path problem, you may want to try:



var local = location.pathname.split(/);
local.pop(); // remove the filename
local.pop(); // remove the containing directory
local.push(Error.aspx);
local = location.protocol+//+location.hostname+/+local.join(/);
top.location.href = local;

[#86586] Sunday, March 25, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
calicinthias

Total Points: 447
Total Questions: 101
Total Answers: 118

Location: Botswana
Member since Sat, Dec 31, 2022
1 Year ago
calicinthias questions
Sun, Jan 2, 22, 00:00, 2 Years ago
Wed, Jan 13, 21, 00:00, 3 Years ago
Mon, Aug 10, 20, 00:00, 4 Years ago
;