Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phone links are not working inside iframe though it does work in div in iOS9 web. how to make phone links make work in iOS9 safari?

Hi I was trying phone links inside iframe in iOS9. Phone application doesn't open up in safari in iOS9. When i tried same link inside then it is working there.

I was trying below anchor tag. This code opens up phone application when put inside div. But same code doesn't work inside iframe. Please suggest how does it make to work inside iframes as well?

Please use below code to see phone link outside iframe

<a href = "tel://1-408-555-5555">1-408-555-5555</a>

Please use below code to verify phone link inside iframe.

<iframe  id = "test" style = "border:none;"></iframe>
<script>
var iframe = document.getElementById("test");
var iDoc = iframe.contentDocument;
iDoc.write('<a href = "tel://1-408-555-5555">1-408-555-5555</a>');
</script>
like image 698
Suresh Dube Avatar asked Oct 26 '15 06:10

Suresh Dube


People also ask

Does Safari support iframe?

sandbox attribute for iframes is Fully Supported on Safari 7.1, which means that any user who'd be accessing your page through Safari 7.1 can see it perfectly.

How do I enable iframe in Safari?

Step 1: Go to Settings icon. Step 2: Select “Safari” Page 4 Confidential 11/16/2017 iPhone and Macbooks Safari SETTINGS to LOAD IFRAMES IN MEMBERS PORTAL 3 Step 3: Ensure that the “Block Pop-ups”, “Prevent Cross-Site Tracking” and “Block all Cookies” are not selected (not green).


1 Answers

Today I had the same problem and found a simple solution for it. Just use target="_parent" and the Links will also work in safari on iOS9.

<iframe  id = "test" style = "border:none;"></iframe>
<script>
var iframe = document.getElementById("test");
var iDoc = iframe.contentDocument;
iDoc.write('<a target="_parent" href = "tel://1-408-555-5555">1-408-555-5555</a>');
</script>
like image 117
Filu82 Avatar answered Oct 11 '22 14:10

Filu82