4

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Md. Ziyed Uddin
  • 180
  • 1
  • 1
  • 10
  • 1
    safari (used too) block popups by default check in settings > Safari > Block Pop-ups. I don't often use iOS so this might be out of date, give it a try anyway. – digital-pollution May 10 '18 at 13:27
  • @Matthew OP just said he's building a AMP page so he can't use javascript. – digital-pollution May 10 '18 at 13:28
  • I have tried this settings > Safari > Block Pop-ups, but the problem not fixed. Click on link does not opening to new window rather it open on the same window. – Md. Ziyed Uddin May 11 '18 at 05:14
  • Try to open an [AMPHTML issue](https://github.com/ampproject/amphtml/issues) in their official github page. – ReyAnthonyRenacia May 11 '18 at 11:48
  • Yes! i have already created issue on AMPHTML official github page and waiting for reply. Thanks noogui for your suggestion – Md. Ziyed Uddin May 11 '18 at 13:17
  • in safari mobile settings, there is an option to disable the _blank target; it is enabled by default. so I had to add the _blank target conditionally if it is not safari mobile using javascript. – saida lachgar Dec 21 '22 at 11:26

2 Answers2

7

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.

Md. Ziyed Uddin
  • 180
  • 1
  • 1
  • 10
  • 3
    I am still having this problem even if page and link follow both the same protocol (http or https). I tried the new html 5 download attribute without success. Also tried different Safari settings without luck. Then downloaded Chrome but chrome is also not opening a new tab, Are there more ideas? – Karl Mar 28 '19 at 09:52
  • the issue is due to http and this will not occur on https. verified !! – Ali Ammaar May 15 '20 at 11:27
  • 5
    I get the same issue regardless of the protocol. – Daniel Douglas Aug 17 '20 at 09:46
  • 1
    Also same issue regardless of the protocol – Janar Apr 20 '22 at 13:56
1

This issue could also be caused by the pop up blocker built on IOS devices, if you go into your settings and then safari settings, and then turn off pop up blocker, I assume it should work.

Also, check out:

Javascript - open new tab in iOS safari without seeing popup warning