Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • jquery redirect

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 133
    Comment on it

    Javascript and jquery redirection is a client side redirection. Redirection means taking a user from one location to another location i.e page. Here are several methods available in jquery and javascript for page redirection such as

    replace() -- which Replaces the current document with a new one.
    assign()-- which loads a new document.
    window.location.replace('http://www.example.com')
    window.location.assign('http://www.example.com')
    

    We can change the location object href property like this which is given below.

    window.location.href = 'http://www.example.com'
    document.location.href = '/path'
    

    // window.history

    window.history.back()
    We can also redirect using go() methods  which loads a history url from list.
    window.history.go(-1)
    

    // window.navigate; ONLY for old versions of IE

    window.navigate('top.jsp')
    self.location = 'http://www.example.com';
    top.location = 'http://www.example.com';
    

    We can do redirection using attr and prop function.

    $(location).attr('href','http://www.example.com')
    $(window).attr('location','http://www.example.com')
    $(location).prop('href', 'http://www.example.com')
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: