Anchor positioning issue

1,086 views
Skip to first unread message

Alexey Breslavsky

unread,
May 17, 2015, 5:02:00 AM5/17/15
to chromium...@chromium.org
Please go to the following link: http://www.herco.com/Catalog/Detail?Thumb=False#2
Problem: browser don't positioning to anchor #2 (<a id="2"...) after loading the page. The same problem is for other anchors in the page.
This problem is specific only for Chrome. It properly works in FireFox and IE.

Thanks,
Aleksey

Alexey Breslavsky

unread,
May 18, 2015, 9:34:33 AM5/18/15
to chromium...@chromium.org
To fix this problem I added following script to the page:

$(document).ready(function () {
            var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
            if (window.location.hash && isChrome) {
                setTimeout(function () {
                    var hash = window.location.hash;
                    window.location.hash = "";
                    window.location.hash = hash;
                }, 300);
            }
        });


Looks like a bug in Chrome.

PhistucK

unread,
May 18, 2015, 10:15:20 AM5/18/15
to alex...@gmail.com, Chromium-discuss

PhistucK

unread,
May 18, 2015, 10:16:58 AM5/18/15
to alex...@gmail.com, Chromium-discuss
Which suggests something in your code is scrolling to the top of the page.


PhistucK

Alexey Breslavsky

unread,
May 20, 2015, 10:50:45 AM5/20/15
to chromium...@chromium.org, alex...@gmail.com
PhistucK.

You are right. The reason is on the page located unvisible input element which receives focus on load.

Issue is closed.

Thank you for the answer.

понедельник, 18 мая 2015 г., 17:16:58 UTC+3 пользователь PhistucK написал:
Reply all
Reply to author
Forward
0 new messages