Response.redirect doesn't change address bar url in Node.js

2,170 views
Skip to first unread message

feras ahmed

unread,
Apr 21, 2012, 9:12:36 AM4/21/12
to expre...@googlegroups.com

I'am using express js to create a web app. In some get requests I redirect user to another page whenever he clicks the link:

a( data-icon='home', data-transition='fade', data-role='button', data-theme='a',href='/logout') Home

The following code handles the logout: // app.get('/logout'...)

logout: function(req, res) {
    req.logout();
    res.redirect('/');
}

This actually log out the user but address bar url still points to http://localhost:3000/logout . What is wrong with this?

Thanks,

Jed Wood

unread,
Apr 21, 2012, 1:18:51 PM4/21/12
to expre...@googlegroups.com
Feras-

It looks like you're using jQuery Mobile. By default jqm hijacks all your links, calls them via ajax, and then updates the browser address bar manually. So it's essentially ignoring the header that Express is sending back that tells it about the url it's redirecting to. You can override it with rel=external . 


-Jed
Reply all
Reply to author
Forward
0 new messages