Anchor tag doesn't work in iPhone Safari

前端 未结 5 636
一个人的身影
一个人的身影 2020-12-06 18:10

I\'m having an issue with a named anchor tag in iPhone Safari browser. It works well in desktop browsers including Safari, but not working in mobile Safari. Weird!

F

5条回答
  •  温柔的废话
    2020-12-06 18:50

    Safari loses the anchor tag after redirecting. So avoid anything that leads to a (second) redirect.

    • use the full URL (http://...)
    • note if there is a redirect to www or not (www.domain...)
    • add a trailing / if there is no prefix like .html/.php (mypage/)

      http://www.domain.tdl/mypage/#safari
      

    Maybe it's useful to check for a redirect using tools like cURL

    curl -I http://www.domain.tdl/mypage/#safari
    

提交回复
热议问题