I'm helping to build a webpage that is mobile friendly. We are currently in beta and using the "Add to Homescreen" function of Safari on iOS to make the webpage appear as an app. Is there a way through javascript or html to code a link to Safari's share menu? We want to be able to access this share menu from the bookmark shortcut rather than having to be in the actual Safari browser on the phone.
This is an old question, but as of iOS Safari 12.2 and macOS Safari 12.1, Safari supports Navigator.share() to display the system share menu.
The Share menu in Safari is a component of the browser, not the web page. It cannot be linked to.
If you want your users to activate the "Add to Homescreen" function of Safari, you will need to instruct them to press the Share button themselves.
Related
What are the differences in terms of features or apis of Safari webview and regular safari on iOS? Is there a way to detect if a website is open in Safari webview like say from Twitter?
Currently I have pwa enabled in my app, but for iOS, the user has to add the app to their homescreen using the share button. Now, when the link is opened from twitter app, twitter renders the website in Safari webview. I'm trying to detect if website is opened in safari webview so I can show a message to user on how to add the app to their homescreen due to the safari webview limitations where Add to home is not available in the share sheet.
I send an email with a link of my PWA website.
When I click on the link and say open with Safari it opens in the Safari webview.
The Safari webview however does not have an add to homescreen option like the native Safari browser does.
When I open the link with my native safari browser I get the ability to add to homescreen.
What can I do to open the link directly in the native Safari browser instead of the webview.
Alternatively is there a way to find out that I am in the webview instead of the native Safari browser to prompt the user accordingly?
Currently testing on iOS 14.2
You are using the Gmail App to open the link so it is prompting you which browser that you want to open the link with.
To open the link directly into the Safari browser instead of the webview (assuming you have it set as your default browser under Settings), click on the "Default browser app" option below the Safari option.
It is currently not possible to detect and prompt the user accordingly, however you could play around with window.navigator.standalone to detect if the user is in the PWA or not.
I run a couple of blogs and I do not want my sites to be viewed from a Opera Mini mobile browser. I want to force my links to open on other browsers present on their devices other than Opera Mini. Basically, when my link gets clicked on by Opera Mini users, I want my site to open on other browsers present.
I have tried all I could but to no avail. I shall appreciate every help I can get over this.
You can check the USER AGENT of Opera Mini and show a message to the users.... but you can't open automatically another app from browser website, there are security restrictions.
Here you can find the useragent string for Opera Mini: http://www.useragentstring.com/pages/Opera%20Mini/
Here a good answer for check the user agente via javascript: Getting the User Agent with JavaScript
is there a way to let the user add a desktop shortcut of a website with just javascript or a simple link? I mean on mobile devices, especially android and ios.
There are other questions similar to this but they didn't give me a useful answer till now.
I don't know about android, but on iOS no. I'm not sure why you would want to do this anyway in mobile safari it's as simple as clicking the share button in the tool bar and the click "add to home screen"
There exist javascript APIs for adding bookmarks to browser using javascript, but it works only on Desktop
Firefox
window.sidebar.addPanel(location.href,document.title,"");
IE
window.external.AddFavorite(location.href,document.title);
http://www.hostingfanatic.com/webdev/add-to-bookmarks-javascript/
The above site hosts the code for it, the functionality works in Desktop FireFox and InternetExplorer but not in Desktop chrome or Safari.
The add bookmark also doesnt work on android default browser or android FireFox browser.
It also doesnt work on IOS Safari, on IPad 1 and IPad 2
Is there any javascript API that allows the add bookmark functionality programmatically via javascript in mobile browsers?
If not, is there any other way to achieve this programmatically in mobile browsers?
Also will Phonegap or rooting the android phone, help in any way to achieve this?
I am open to all views.