Treehouse: Grow your CSS skills. Land your dream job.

Browser adding # to URL in address bar / page jumping to top

  • # June 13, 2014 at 2:14 pm

    I recently built out a website for a good friend of mine using a nice template. Towards the launch date i started noticing this # that would appear at first only in IE, but now Chrome is showing it too.

    I also noticed when i link to a another page or section of a page and then use my <back> button, it jumps to the top of the page. Almost like it sees another anchor maybe, weird and very frustrating because the navigation is not smooth and looks ugly.

    We had to go live with the site like it is, but I hate leaving something so tackie out there, knowing it is not right. I know I can’t be the only one who has had issue..

    my friend’s site – http://leelawgroup.net

    Has anyone seen this and better yet how is this fixed

    thanks

    # June 13, 2014 at 6:47 pm

    How can I make this happen? Can’t seem to reproduce.

    # July 1, 2014 at 6:05 pm

    I just loaded the site without issues. Where exactly is the # showing up at?

    # July 6, 2014 at 7:16 am

    I couldn’t reproduce it either, but there are a number of javascript errors that look like plugins not getting what they think they need. In general, this sounds like a javascript-related issue redirecting to “#” which is sometimes used as a ‘null’. Typically, an in-page jump-link will have the HREF = an ID (href=”#top” for instance) and a template may just have the ‘#’ as a placeholder. the outcome will be that the page reloads, or if it’s driven by javascript, it may just go to the top of the page as a default.

    # July 6, 2014 at 7:16 am

    oops, darn double-post

    # July 12, 2014 at 10:07 pm

    Not sure where you went off to, but I usually put href=”javascript:void(0)” into buttons that are for modals and things

    # July 13, 2014 at 4:41 am

    yeah, I agree with yeahmkd, it looks like you’ve used href=”#”, you should have it set to href=”javascript:void(0)”.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.