3

I'm using Flexpaper Zine in an iPad web app as my PDF reader. I love that it is easy to use and customize.

I was asked to add an e-mail button to the toolbar so customers viewing the app can e-mail themselves the PDF.

I figured out how to add the button to the toolbar, however, setting the button do what I want is my dilemma.

The administrator from Flexpaper says to simply add a JavaScript to the tag where the custom button is. I have:

<element type="button" id="bttnEmail" height="14" width="13" onclick="myscript()" />

but I don't know what to write for the script. On click (or on tap, since it's a mobile device), I want the native mail application to launch without a prepopulated mailto, but I do want to prepopulate the subject line and add a link to the PDF in the body.

Is it possible that this isn't possible?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Lisa G.
  • 114
  • 1
  • 8

1 Answers1

2

I have not worked with Flexpaper so far but the following snippet works in a browser address bar

mailto:?subject=My%20subject&body=message%20goes%20here

And encapsulated in a function

function myscript() {
    window.location = "mailto:?body=Your content&subject=Mail Subject";
}

Please let me know when the window object is not available or it does not work.

Useful links

Automically open default email client and pre-populate content

Open an email program with subject and body prefilled is not working correct

Community
  • 1
  • 1
Markus
  • 763
  • 7
  • 24
  • Thank you, Markus. I believe this works, I just need to figure out where to add the function in the Flexpaper configuration. I'm close, and the script you gave was key. I just don't understand javascript well, php at all, and their relationship yet. – Lisa G. Apr 10 '14 at 21:09
  • Just to update, I added the function in my index.html file. The script works perfectly in a browser. Now I need to figure out how to get it to work with PhoneGap. – Lisa G. May 21 '14 at 18:38
  • Thank you, Markus. I don't need to add attachments, just the link in the body, so I have the other EmailComposer plugin. I also have the InAppBrowser plugin and various others. I think it has something to do with the way the function is written. Here's a link to my question about that issue. http://stackoverflow.com/questions/23769308/web-app-javascript-mailto-function-doesnt-work-in-native-app-after-phonegap-bui – Lisa G. May 22 '14 at 21:24