I am a hybrid mobile application developer. In my application, the user can enter their own HTML, CSS and javascript code and they can get its output. Now I have the plan create an HTML file from user typed code and send it through email or other sharing application. For sharing the HTML file I am using the following cordova plugin
https://www.npmjs.com/package/cordova-plugin-email#determine-if-the-device-is-capable-to-send-emails
I can successfully generate and send the HTML file through mail, using the below code
cordova.plugins.email.open({
to: 'merbi...@gmail.com',
subject: 'Greetings',
body: '<h1>Test mail</h1> file generated from Test app',
isHtml: true,
attachments:'base64:file.html//PGh0bWw+DQo8aGVhZD4NCjx0aXRsZT5UZXN0aW5nIHRpdGxlPC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KVGhpcyBpcyB0aGUgdGVzdGluZyBib2R5DQo8L2JvZHk+DQo8L2h0bWw+'
});
But my problem is how to generate DATA URI from HTML strings? I can able to generate DATA URI from HTML file.
I used the following method to generate DATA URI
Convert HTML to data:text/html link using JavaScript But it doesn't support.