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

会有一股神秘感。 提交于 2019-12-12 20:02:30

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/50273899/amp-html-a-target-blank-not-working-on-iphone-safari-browser-to-go-new-wind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!