I use this js condition to run some code if a certain page is visited.
if (location.pathname == '/members/') {
console.log("members page reached")
}
It works in all browsers on Windows, Android or Linux.
But the code somehow doesn't run on iOS devices. Is there something about location.pathname on iOS?
How can I get it to work on iOS device?
Related
I'm trying to automate a scenario where I can switch to desired iframe and execute a console command, this is working fine in websites only, I need to do the same for android and iOS too, things that I have tried and working which is working fine in web are :
Automation tool that i'm using is Katalon Studio
def switchIframe(String iframe_id) {
if(platform.equals('web')) {
WebDriver webDriver = DriverFactory.getWebDriver()
webDriver.switchTo().frame(iframe_id)
}
...Calling above keyword in my script is ----> actions.switchIframetest('in.juspay.flyer')
after switching to specific iframe I'm executing a command state()
I need to perform same in android and iOS can anyone please give me a solution
Note : The application that I'm using in android and iOS is not WebView application.
We are currently developing a PWA for a client of ours. Everything has been going well, but while testing on iPhone (iOS 12.2) we are having an issue with the tags that have sms:123-456-7890 in the href. You get the "Safari cannot open this page because of the sms: tag" (paraphrasing).
If you are browsing the site via Safari (not in the PWA mode), the anchor tag works fine and your iMessage opens up with the number in it. But when you're in the PWA mode and click the link, you get a version of the message I mentioned above.
From doing research, this appears to be some sort of bug in the iOS 12.2 release, though not officially mentioned.
I'm curious if anyone has had any luck with a work-around for this issue?
Thanks in advance.
Edit..to add some code for the anchor tag....
123-456-7890
I've tried many different variations of the sms (with no // or ;), always same outcome when clicking it as a PWA. With Android, everything works fine in PWA mode.
I did find a workaround by using JavaScript
Code Example:
<a href="#" onclick="openSMSMobile();" >
function openSMSMobile(e) {
window.open('sms:1234567890', '_self');
return false;
}
And in case anyone is wondering, if you'd like to add text to the message body, you can use,
window.open('sms:1234567890&body=textGoesHere', '_self');
For Android you'll need,
window.open('sms:1234567890&body=textGoesHere', '_self');
I am trying to dial a phone number in iOS, however I only have the simulator and an iPod Touch to test on.
The code uses something along the lines of:
window.location.href = 'tel:01234567890';
Working fine with Android, but in iOS it dies with:
Failed to load webpage with error: The URL can't be shown
Now, I do realise this has been asked before, but the general consensus from some time ago was "It doesn't work, you'll need to use a plugin". There haven't been many questions on this for some time though, and what questions there are seem to suggest it works when doing it programmatically (as above with window.location.href). I have tried the iOS PhoneDialer and the newer version of the same plugin, but both have errors in XCode (ARC forbids explicit message send of 'release') - a bit of faffing and I can get this running, but then PhoneGap doesn't find the plugin - it really feels like I'm hitting a brick wall with this method, and I can't believe something as simple as this requires something so over the top.
I know you cannot auto-dial/auto-call a number for security reasons, but all I need to do is open the dialer with number pre-populated, which is surely no different to a mailto:info#example.com link opening your email client with the sender pre-populated?
So, my questions are:
Has this changed with a recent update to PhoneGap, iOS or XCode?
Or, is it a case that I cannot do this on an iPod or Simulator, and it will work fine on an iPhone?
How can I fix it? :)
You didn't specify which version of Cordova you are using so I'm going to assume version > 3.
Make sure that InAppBrowser, a plugin since version 3, is installed and then open the link by calling it through Javascript like this:
window.open('tel:12345678', '_system')
_system will open it with the systems own browser which in turn will open the call dialog, if you use it against http://maps.apple.com/ it will open in the maps app and similar for other apps which opens for special urls.
Remarks:
As described in the docs of the InAppBrowser plugin the window.open function won't be set automatically. You have to do it your self: window.open = cordova.InAppBrowser.open;. Instead you can directly use cordova.InAppBrowser.open('tel:12345678', '_system');
Make sure your number doesn't have any blankspaces in it (the +
prefix is okay). For example you could use a function like the following,
assuming num is a string.
Function:
function placeCall(num) {
if (window.cordova) {
cordova.InAppBrowser.open('tel:' + num.replace(/\s/g,''), '_system');
}
}
Below Code works perfectly fine for iphone:-
window.open('tel:123456', '_system');
Simulator doesn't support dialer. No need to waste time.
Make sure that the phone number in your href also doesn't have any formatting in it, as on iOS it causes the link not to work in a PhoneGap App. So for example, use tel:0390005555, and not tel:(03) 9000 5555.
I don't believe this is a Cordova issue. I know in native iOS you cannot bring up the dialer on the simulator or on an iPod touch. You will need to test this on an actual iPhone.
I know this is a late answer time.
Try by adding // to the url. Like this tel://xxxxxxxxx and see if it works.
Worked for me in IOS 8.4, iPhone 6, 6+ as of today.
I have a website that uses flash.
Is it possible to do something like this
pseudo code
if (user_agent == iOS[ipad, iphone, what-have-you])
show_ios_component
else
show_flash_component
My question is thus: is there a way to build "apps" that run on websites.
I see this all the time for video sites like YouTube, MSNBC etc i.e. that their video player all of a sudden works in iOS browsers like safari and chrome run on iPad, iPhone etc.
Thanks.
Flash won't run on IOS. An app that runs on a website is in this case an .swf(Flash). Those sites use a HTML5 fallback for the videos, so you will have determin in the browser which OS the target has, and then either show the swf or HTML5 component. One usually does that in javascript
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
this snippet will tell you if IOS is true or false.
I have a problem where a web app which is running fine in iOS safari for the iPad, is not working the same when being launched from the iPad home screen as a web-app. The code is exactly the same, cache etc has been flushed, but for some reason a bit of JS which is loading some content just isn't executing in web-app mode, but is running fine in Safari!
Is there anything which could be causing this? Many thanks
Update: what i'm doing is loading a jquery timeline library, using the following initialisation code in the page footer:
function checkTimeline() {
if ($('.flag-content').length > 0) {
timelineLoaded();
} else {
window.setTimeout(checkTimeline, 100);
}
}
checkTimeline();
In iOS Safari, this works fine and checks the timeline is loaded before attaching events (via the timelineLoaded() function), but in web-app mode, which I thought was just effectively full screen safari mode, the checkTimeline function never meets the first condition. Baffling!
If you are using seperate JS file then check whether the Js file is added in the Build Phases -> Copy Bundle Resources. If not add it manually and try again its working properly.