简体   繁体   中英

a href #section tag not working in safari

The menu at the top on http://www.blackcoatinnovations.com the about and contact section are on the same page #third and #footer respectively. Those link work correctly in firefox as the <a href"http://blackcoatinnovations.com/#third"> syntax was used in the menu but in safari on mac and ipad/iphone the page just refreshes.

Anyone know what I am doing wrong? I am using the menu function of wordpress and funnily enough if I only write #third in the link instead of the full link, it does work! But I can't have that because then the menu would not work from the blog section of the website.

Simple fix here. You'll want to change the href to just "#third" and not the whole url.

<a href="http://blackcoatinnovations.com/#third"> becomes <a href="#third">

When you write http inside of the url, this is actually telling the browser that you are directing it to a new domain. Since you want to stay on your own domain, you remove the http and the domain itself because you want to open up (a) the index (that '/') and (b) you want to go to a single portion (being the '#third').

I hope you understand why you don't need the http://blackcoatinnovations.com/ beginning now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM