I have a site embedded in an iframe from where I want to launch a mobile app. The following is bound to an onClick action on my button, and works in both Chrome and Firefox on my Android:
window.location = "scheme://app.com/?action=xxxxx"
However, when trying on Safari on iOS, nothing happens at all when clicking the button. If i go to the site directly (instead of iframing it) it works perfectly.
The same thing happens if I use an anchor tag:
I tried to fix this by using window.top.location, but then I run into Same-origin policy issues. The site that is hosting the iframe is on a different domain which I can't control.
Is there a workaround for this?
Related
iFrame interactions are not working in WKWebView. The same iFrames works on UIWebView and Safari.
What have I done so far:
Debugging webpage with Safari Web Inspector, Console does not display any message relevant to this issue
XCode Debugger does not show any message relevant to this issue
Found a similar post about the iFrame problem inside WKWebView https://forums.developer.apple.com/message/179394#179394
Let’s say I have a webpage and it has a button with an HREF attribute. I want the HREF of that button to be opened on Safari browser if the button is being clicked from an iOS device, even if the user is accessing the page on Google Chrome.
As of now, I only need to handle this situation for Chrome and not any generic browser. The way I see it, there are two parts to the problem:
Identifying the OS of the Client Machine: This I might be able to do easily.
Opening the Popup on Safari from Chrome: This is the tricky part I am not sure if it is possible.
I am looking for possibilities of accomplishing the second part.
Short Answer: no.
Long Answer: Some iOS apps have defined URL schemes that can be used to access the app directly from the browser. For example, twitter://timeline. But Safari for iOS does not have one.
You can detect the OS the user is using and if it Chrome then suggest the user to open it in Safari and also provide the link where to download it from. Or you can also suggest the user to make safari their default browser. ( Also provide a link on how to do that to them).
I have an url like this myapp://select?param1=_4O0MSbkzwSzKe_Wcqmm2kSfgmxozRMA2U5dqhPkrfY¶m2=cc5646c4e12341020012fc0
Navigating into the url opens my app.
But the same does not work on chrome and Samsung default browser and it opens the search screen
It works fine on firefox and opera.
I checked links Samsung devices not opening app from browser url scheme in android.
But opening with javascript:windows.location='myurl' also does not work. (This works on Chrome but).
There is an already fixed bug https://code.google.com/p/chromium/issues/detail?id=181186 on chromium.
Thanks and Regrards,
Saurav
You can try 'intent://view?xxx=123#Intent;package=com.example.myapp;scheme=myapp;launchFlags=abc;end;' when normal 'myapp://xx?' way did not work after a short time delay.
Test to trigger via window.location or link custom event, or iframe's src one by one. At least one is suitable for your browser.
lol
I have a webpage from https://creator.zoho.com that contains an iframe. The iframe scr is http://somedomain.example.com (NOTE that it is not https). The iframe content contains scripts for JQuery, SignalR etc.
I get the following behavior across OS and browsers with their default security settings:
Windows
Internet Explorer - No issues, works fine.
Chrome - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the right of the address bar and on click the message is "the page includes scripts from unauthenticated sources." I have an option "Load unsafe script". I click it and everything is works.
Firefox - Does not load anything in the iframe. No security indicator nor any warnings.
Safari - No issues, works fine.
Mac OS
Chrome - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the right of the address bar and on click the message is "the page includes scripts from unauthenticated sources." I have an option "Load unsafe script". I click it and everything is works.
Firefox - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the left of the address bar and on click the there is a security related message. I have an option "Load unsafe script". I click it and everything is works.
Safari - Does not load the iframe context at all. No security warning. No indication that something is blocked.
Does anyone have a clue as to what is wrong?
After a good amount of Googling, I can came across - https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options - but not very sure if this is a solution for my case for all browsers OR if it is even the right solution for any browser for the situation that I am facing.
Thanks in advance for reading my post.
My problem was resolved by moving the application (that was loading in the iframe) to HTTPS. So now the parent page and the iframe both are on HTTPS. They still on different domains, but both being HTTPS solved the issue for me.
I am currently using the following JS code to trigger a file download without leaving the page I'm on:
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
iframe.src = "/somefile.zip";
It works well pretty much everywhere I tested except on both the stock Android browser and Dolphin, where the download doesn't start at all. So far so good, after some research this hidden iframe trick happens to be known not to work on the Android browser.
But I tried several other methods to trigger the download on the Android browser, including window.open() (not reliable because popup blocking is enabled by default), or <a target="_blank"> with a simulated click() (which from a popup blocker perspective amounts to window.open() and gets blocked), or document.location = ... which downloads the file but breaks my app.
The problem with the latter document.location = ... is that this is a Comet application (server-push / long polling) so I really can't leave the page I'm currently on (and "leaving" includes changing document.location even for a file download, even if apparently the browser stays on the current page) otherwise the long polling connection is stopped and the updates stop, the app breaks. This obviously also applies when clicking normal links, either manually or simulated.
So in order not to break my app I really need to trigger a file download without leaving the page I'm on. Unfortunately I didn't find any viable solution that also works on the stock Android browser.
Any ideas?
Thanks for reading me.
Try using the anchor and simulated click without using a target=blank
I say this because I had a similar download consisting of an iframe and a simple link as fallback. The iframe worked on everything but the android, but the simple link would download successfully without leaving the page.