Redirecting to the root directory with JavaScript in Asp.Net

0

I have the following problem: I execute my application and start on the default.aspx page, I execute the following function from a button

function RedirectPage() { location.href = ../View/otherpage.aspx;}

Now I need to return to default.aspx and execute this function but it does not work ... what am I doing wrong?

function RedirectPage() { location.href = ../default.aspx;}

    
asked by Efrain Mejias C 04.11.2016 в 21:22
source

1 answer

1

The route must be in quotation marks:

function RedirectPage() { location.href = "../View/otherpage.aspx";}

If your otherpage.aspx page is loaded inside an iframe you should use the property:

window.parent.location.href

or if you want to make sure you reach the top level:

window.top.location.href
    
answered by 08.11.2016 / 19:36
source