User-Agent information does not helps to identify if request comes from iPAD or MAC OS in Safari Browser - user-agent

I am trying to know if the rest API request is coming from the iPad / mac OS of the safari browser. But, USER-AGENT header information remains the same for iPad & mac from safari browser.
Looking forward to knowing the answer if anyone found the solution.

If you query - "navigator.appVersion" it gives the same value for Mac and IPAD for Safari browser. But you can use an alternate property like - "navigator.maxTouchPoints" which gives a value of 5 on IPAD and 0 on mac. This can be used to differentiate the user agent rather than picking it up from the request header.

Related

Not able to handle windows authentication window using Appium in safari browser

We are automating our website using Appium in Mac iOS device .
when we access our application, it shows windows authentication pop up window. we used the format(https;//username:password#test.com) to handle the windows popup window in chrome and Firefox browser and it is working fine . but windows authentication popup window is appearing in safari browser. could you please let us know how we can handle windows popup window in safari browser
my system configuration
Mac OS version 10.14.5(macOS Mojave)
Appium version 1.14.2
iPhone version 12.4
What does the windows popup in Safari browser look like? If it's a standard login form with username / password inputs, you may need to locate the username / password textfield elements & call SendKeys.
I recommend using the Appium inspector to reproduce your scenario & inspect the Safari browser there.
I have faced a similar issue when handling my organization's single sign on page. After logging in & automatically closing the sign on browser page, my AppiumDriver context became stale & stopped working. so I had to call Driver.BackgroundApp(); to fix it.
If the username / password input is an 'Alert' style popup, you can refer to this forum here which has a few workarounds:
https://discuss.appium.io/t/handle-http-authentication-on-ios-safari/1480/7
Thank you so much for replying my question .
the below code is working perfectly
driver.get("https://test.com");
driver.context("NATIVE_APP");
driver.findElement(By.Xpath("uname"));
driver.findElement(By.Xpath("pwd"));
driver.findElement(By.Xpath("login"));
driver.context("WEB_VIEW");

Calling getUserMedia on Safari causes sound on mac os x to be silent for a second

As of Safari 11, they have started supporting WebRTC apis natively.
In my web application I am using navigator.mediaDevices.getUserMedia to get control of the microphone.
I noticed that, only in Safari, when my code calls getUserMedia, the sound on my computer gets low then comes back up to normal volume after a second.
I have tested this on another website: https://simpl.info/getusermedia/
When I loaded the website, I did not see the issue..
The site above only requests for video, but the code is very simple and not minified. I put a breakpoint right where it calls getUserMedia and added the constraint for audio and I was able to reproduce the issue.
Has anyone else had this problem? I am unable to find anything online describing this issue.
I am running Mac OSx El Capitan. I know I am out of date but people have told me that this happens on Sierra as well.
The same on High Sierra.
My guess is they try to avoid audio spikes or to go easy on the echo canceler.

Cross domain ajax does not work with redirect in mobile safari

I'm experiencing this issue that's mentioned in this WebKit bug:
https://bugs.webkit.org/show_bug.cgi?id=57600
The issue is with mobile Safari, it works with Google Chrome and Firefox. The same code where I redirect a cross domain ajax request works with Google Chrome and Firefox, but doesn't with mobile Safari.
As I understand the bug was filed in WebKit version 525:
https://bugs.webkit.org/show_bug.cgi?id=57600
And solved in WebKit version 528 (I figured this since a different regression bug was opened on the same issue):
https://lists.webkit.org/pipermail/webkit-unassigned/2012-April/429252.html
But with my mobile Safari on an iPhone device, the redirect is denied, even though I have mobile Safari with WebKit version 534 (a much later version).
Has anyone experienced this behavior, and is there a solution to this?
Note: I do have the cross domain (CORS) headers defined (since it is working in Google Chrome and Firefox).
Edit: The same issue with Safari for Windows.
I've encountered the same issue with several mobile browsers (Safari, Chrome/Dolphin on Android).
I've no solution for the 302, but I found a workaround:
the Java framework we use can either redirect or forward POST responses, so we changed it to forwards mode.
Using forwards result in a 200, so the AJAX success handler (we use jQuery) can retrieve the data properly.
Hope this helps.

Detecting tab using 51Degrees.mobi Foundation

I am trying out to detect the Ipad or Samsung Galaxy Tab or any other Tab using 51Degrees.mobi Foundation library.
I am using Request.Browser["is_tablet"] but it is returning me false. Is there any one who knows if this is the known issue or I am making some mistake.
I am testing this using Opera Mobile Emulator
can you give me URL to download the simulator for iPad?
I am describing again my issue below--
I am using 51Degrees.mobi Foundation in my MVC application. When I use Request.Browser["is_tablet"] in my View Engine to check if request is from tab, its giving me false as a result. This is happening for Samsung Galaxy Tab(Opera Mobile Emulator) and Ipad (AIRiPad emulator).
In this case the Request.Browser.IsMobileDevice and Request.Browser["is_wireless_device"] is also returning false. Hence the regular MVC views designed for desktop is getting loaded.
I am not using Locations in config file as I need to redirect to appropriate views from my view engine when request is from mobile or tablet.
Let me know is there any knows issue with is_tablet or Am I doing it wrong way or is there issue with emulator?
If you are using the open source lite device data, then you won't be able to detect the tablet capability. You can however detect both whether the device is mobile (IsMobile (boolean)) and the screen size (ScreenPixelsHeight (int) and ScreenPixelsWidth (int)). You may be able to determine whether or not the device is a tablet by using a combination of these values.
You can check the avaliable properties using the property dictionary here. Hope this helps.
Request.Browser["is_tablet"] works fine for me:
used the iPad simulator from Blackbaud labs.
http://labs.blackbaud.com/NetCommunity/article?artid=662
User-Agent:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
Check your logfile App_Data/Log.txt for this entry:
Info - Loaded 14691 devices using 12720 strings in 2295ms
set the log level to debug in your config file
< log logFile="~/App_Data/Log.txt" logLevel="Debug"/>

Bring back mobile version of website in WebBrowser control for wp7?

Is it possible to bring back web pages in a mobile format, if available, before showing the normal rendering of a web page? I noticed I was getting both when I used it. Or is this enabled by default?
EDIT: For example in ie on the phone you can request to recieve webpages in a mobile version or desktop version. Is this option available to developers and if not what is the default for the control?
Sadly, there's no API for toggling this setting - and no easy way to intercept the outgoing HTTP calls from the browser control.
Looking at some output from the emulator it looks like the mobile/full setting toggles this in the User-Agent:
Mobile -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
Desktop -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+XBLWP7;+ZuneWP7)
Here also are some mobile agents captured "in the wild" - http://www.elucidsoft.com/blog/2010/11/19/windows-phone-7-user-agents/
It looks like this settings is a global setting for the OS - so whatever the user chooses in the browser settings is also used in your app (I think this is what I just saw).
I had this problem for a very, very long time and I finally figured it out with the following:
string header =
"User-Agent:Mozilla/5.0 (iPhone; U;
CPU iPhone OS 4_1 like Mac OS X;
en-us) AppleWebKit/532.9 (KHTML, like
Gecko) Version/4.0.5 Mobile/8B117
Safari/6531.22.7";
MyWebBrowser.Navigate(new
Uri("http://www.google.com"), null,
header);
The following header DID NOT work for me (on the gmail website):
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
The WebBrowser control does not expose an API that enables you to choose between the Desktop or the Mobile version of a web page. You could use Fiddler to trap the traffic for outgoing requests (from the emulator or a device) to see if there's anything in particular about the request that you might be able to replicate in yoru own requests.

Resources