Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anchor tag doesn't work in iPhone Safari

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!

For example my URL looks like:

http://www.example.com/my-example-article-url-is-like.php#articlebottom

the above URL is from a newsletter and it should go to the bottom paragraph in article page which I gave id like this:

<p id="articlebottom">paragraph is here</p>

When I click the above URL from Newsletter it goes to the article page, but not the bottom para where I specify id. Although I can see that the #articlebottom part is missing from URL when it came into the targeted page in Safari.

Any thoughts would be appreciated!

like image 529
Akhil Paul Avatar asked Mar 25 '14 18:03

Akhil Paul


1 Answers

Opera, IE, Chrome and Firefox will carry over the anchor to the new page. However, Safari loses the anchor on the redirect.

So what if you add / just before the ID Tag?

Old URL Path: http://www.example.com/my-example-article-url-is-like.php#articlebottom

New URL Path: http://www.example.com/my-example-article-url-is-like.php/#articlebottom

Another solution is that you'd have to delete both "www." from the domain and add a forward slash before the anchor tag in the URL/pathname before Safari would respond properly. Firefox doesn't seem to care, and I haven't gotten to testing on IE yet.

like image 109
Kheema Pandey Avatar answered Oct 02 '22 02:10

Kheema Pandey