Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Nick Osborne
Nick Osborne
4,612 Points

How can I redirect to an exact screen position python / flask?

In a python flask app, I want to be able to click a button in a post and return to the exact same spot on the screen. At the moment it returns to the top of the screen. I can get to a particular id by doing this:

return redirect(url_for('comment', _anchor='id_spot'))

But, that returns the button to the top of the screen. I want the screen to stay exactly where it is. Does anyone know how to do that? Thank you for any advice!