简体   繁体   中英

AMP Html <a target=“_blank”> not working on iphone safari browser to go new window

Recently I am developing a progressive web app with Accelerated Mobile Pages (AMP). I have to add anchor link with target="_blank" so that a user click on that link will be redirected to a new window with anchor location.

<a href="External_Url" rel="external" target="_blank">Click</a>

It's working fine on Android browser but target="_blank" is totally not working on the iOS Safari browser. I know this can be solved with Javascript but here at AMP we can not use any Javascript due to convention.

Are there any suggestions to make the new window work on the iOS Safari browser on AMP html anchor click with target="_blank" ?

NOTE: I have configured "In New Tab" on iPhone Safari Settings too.

I have investigated the the problem and finally found the proper reason behind the problem.

This is basically happening due to mixed content on document. The site is serving through Https where the links are Http. This is the main cause of safari browser preventing target="_blank" not to go new window. The latest safari browser blocking these type of mixed content links due to security issue.

After serving all the contents as Https including the target="_blank" links, it's working well at my end now.

This issue occours if the target URL responds with a HTTP error message 401: Unauthorized . It happens with or without the target="_blank" attribute .

The problem can be fixed by redirecting the anchor tag to a working URL that responds with the standard HTTP 200 response.

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