- Home /
Webgl : How to use javascript sharing function
Hello. i have a working javascript sharing function (port from another project) that i'd like to use in my webgl project but i dont think it is suitable with unity's webgl.
i have a Pugins folder in the Assets with the .jslib file. in the file :
mergeInto(LibraryManager.library, {
Sharing: function () {
if (navigator.share)
{
navigator.share({
title: 'Street Food Festival',
text: 'Check out it out',
url: 'ur',
}).then(() => console.log('Successful share')).catch((error) => console.log('Error sharing', error));
}
else
{
alert('Sorry. Sharing not available on your device')
}
}
});
c# script wise :
[DllImport("__Internal")]
private static extern void Sharing();
public void ShareExperience()
{
Sharing();
}
and a button click is suppose to trigger it. but when i try to build and run to test, unity throws errors. im pretty sure its the Sharing function but im not sure how to fix it.
Your answer
Follow this Question
Related Questions
Gameobjects not in the right position 0 Answers
MissingMethodException with jslib calling c# functions 0 Answers
Setting Scroll View Width GUILayout 1 Answer
WebGL game slows down after triggering javascript event 0 Answers
Is there a way to send an XMLHttpRequest and get the response in a WWW object? 0 Answers