when i am sharing file with WebShare Api its not showing the text while sharing the file its showing text only in email
<code>const file = new File([this.pdfBlobforData], `${name}.pdf`, {
type: 'application/pdf',
});
if (navigator.canShare && navigator.canShare({ files: [file] })) {
navigator.share({
title: 'Check out this',
text: 'Check it out!',
files: [file], // Share the PDF file
}).then(() => {
console.log('Shared successfully');
}).catch((error) => {
console.error('Error sharing', error);
});
} else {
alert('Your browser does not support sharing files.');
}
</code>
<code>const file = new File([this.pdfBlobforData], `${name}.pdf`, {
type: 'application/pdf',
});
if (navigator.canShare && navigator.canShare({ files: [file] })) {
navigator.share({
title: 'Check out this',
text: 'Check it out!',
files: [file], // Share the PDF file
}).then(() => {
console.log('Shared successfully');
}).catch((error) => {
console.error('Error sharing', error);
});
} else {
alert('Your browser does not support sharing files.');
}
</code>
const file = new File([this.pdfBlobforData], `${name}.pdf`, {
type: 'application/pdf',
});
if (navigator.canShare && navigator.canShare({ files: [file] })) {
navigator.share({
title: 'Check out this',
text: 'Check it out!',
files: [file], // Share the PDF file
}).then(() => {
console.log('Shared successfully');
}).catch((error) => {
console.error('Error sharing', error);
});
} else {
alert('Your browser does not support sharing files.');
}
i want to share file along with title and text
New contributor
Ankur Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1