Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

navigator.share not working in mobile browser(chrome v64)

I have been trying to trigger the Intent Share in the Android browser from javascript using the navigator.share.

Following is an example code:

$("#printTest").click(function(e){
    if (navigator.share === undefined){
        alert('Undefined!');
    }
    else{
        alert('Sharing!');
        navigator.share({title: 'Example Page', text: 'https://example.com'});
    }
});

When I try to click on the button from chrome in ubuntu, it opens a window for sharing(which shows no apps to select though). But the same is not working on any android mobile browser. I have tested in Chrome for Android version 64 and Chrome for Android Dev also. All of the shows the alert 'Undefined' even after enabling the flag chrome://flags/#enable-experimental-web-platform-features.

like image 479
Gopakumar N G Avatar asked Feb 15 '18 07:02

Gopakumar N G


1 Answers

navigator.share will only work on websites with https and not HTTP

like image 78
Gopakumar N G Avatar answered Oct 12 '22 00:10

Gopakumar N G