We have a site with youtube iframe video list (https://developers.google.com/youtube/iframe_api_reference). Only with this list component, switching to "full screen mode" not working good. It's entering to the full screen mode but exists from the mode immediately.
In order to Isolate the situation I did the following tests:
Chrome + react-virtuoso on android Works.
2. Android Webview + react-virtuoso - Doesn't work.
Android Webview + Other list component - Works.
I assume it's related to the error: "Error: Zero-sized element, this should not happen"
Any ideas? How can I disable the above warning?
I'm creating an app on macos with Swift,
The app need to open the Safari,
and i need that the Safari app will always be on the foreground.
Can it be done?
Thanks to #vadian comment, I found the answer
func foreground_safari() {
let apps = NSWorkspace.shared.runningApplications
for app in apps {
if app.localizedName == "Safari" {
if !app.isActive {
app.activate(options: NSApplication.ActivationOptions.activateIgnoringOtherApps)
}
}
}
}
If you want to open safari using a link then try this
UIApplication.shared.open(NSURL(string:"http://www.example.com/")! as URL)
I am using Chrome DevToools through the Chrome remote interface.
One thing I don't see a way to do here is to close an alert box. Is this possible?
I ended up finding a way:
Page.javascriptDialogOpening((params) => {
Page.handleJavaScriptDialog({'accept': true});
});
Does anyone know if there is a service that adds the option to open a URL in the opera mini app from an iOS UIactivity view controller. I have safari and chrome buttons but I am just trying to get the major iOS web browsers
For now I am just trying to open http://www.google.com
It is my understanding that Opera Mini's URL scheme is ohttp://, so you can just download TUSafariActivity from GitHub, change the images for the activity, and use ohttp://www.google.com/ instead of http://www.google.com/ in the activity's NSURL to open Google's home page in Opera Mini instead of Safari.
Opera Mini's url schemes include:
ohttp://
ohttps://
oftp://
I have an iPhone Web App, and I'm interested in detecting if the app was loaded either from:
iPhone Safari
iPhone installed web app (via the add to my home screen) which loads without the safari bars.
Any ideas?
You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property. https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
if (window.navigator.standalone) {
// fullscreen mode
}
You can detect the mode via Javascript as described above - or you can use PHP and the user agent.
<?
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"iphone")) {
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"safari")) {
echo('Running in browser on iPhone');
}else{
echo('Running as stand alone WebApp on iPhone');
}
}else{
echo('Running on device other than iPhone.');
}
?>
Enjoy!
This is what I use, works great:
if (window.navigator.userAgent.indexOf('iPhone') != -1) {
if (window.navigator.standalone == true) {
alert("Yes iPhone! Yes Full Screen!");
} else {
alert("Not Full Screen!");
};} else {
alert("Not iPhone!");
document.location.href = 'please-open-from-an-iphone.html';
};
How to do it with PHP and filter false positives
I think that #strat 's answer is in the right direction, if you want to use PHP. Except that it won't work unless the mobile app capable meta is set. Otherwise the iPhone will place in home a bookmark opening mobile safari.
Also, it returned false positives, for example when accessing the page from any other browser on iPhone, like the Facebook browser.
Luckily, the standalone user agent string has a particularity: it only has 3 slashes in it. I tested various other browsers and they all have more than 3. It's hackish, but we can use this at our advantage. Also, it's interesting to note that a standard webview in a app will have 2 slashes.
So this is the minimum working example:
<?php
// We need to add the mobile web app capable meta. Status bar is set to black to avoid our text go under the status bar.
?>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
</head>
<body>
<?php
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if ( strpos($ua,"iphone") || strpos($ua,"ipad") ) {
if ( strpos($ua,"safari") ) {
echo('Running in safari on iPhone/iPad');
} else if ( substr_count($ua, '/') === 3 ) {
echo('Running as stand alone WebApp on iPhone/iPad');
} else if ( substr_count($ua, '/') === 2 ) {
echo('Running in a WebView on a iPhone/iPad app');
} else {
echo('Running in another browser on iPhone/iPad');
}
} else {
echo('Running on device other than iPhone/iPad.');
}
?>
</body>
</html>
I'm not sure how far back this behavior goes, but iOS will present different UserAgent strings to the server which can be used to detect if the page is being requested by a webapp or safari browser.
Safari Browser
Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B436 Safari/600.1.4
Home Screen Button/Web App
Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B436
Notice it does not include 'Safari' in the UserAgent. I've confirmed that this behavior goes back to at least iOS 7, but I'd imagine even further.
So you can test for the presence of iPhone or iPad in the UserAgent string and lack of Safari to detect that it's been opened from the Home screen.
I prefer this one-liner to determine whether it's fullscreen/in a web app or not.
var webApp = (typeof window.navigator.standalone != 'undefined' && window.navigator.standalone ? true : false);
Check the HTTP-Headers when accessing the site from iPhone Safari and the WebApp to see if they are different.
I don't know if they are, but if they are, I'm sure you'll be able to implement that somewhere in your website.
http://php.net/manual/en/function.headers-list.php
Can be simplified to
var webApp = window.navigator.standalone || false;
Can be simplified again to
var webApp = window.navigator.standalone;