Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter Sign In with OpenID Sign In with Google

Sign In Sign Up

In this Discussion

Welcome to the Jo support forums! Please Sign Up and join in the discussion. You can also Sign In instantly with Twitter, OpenID or your Google ID.
Mailto not working and selecting text on elements doesn't work!
  • jpsheridanjpsheridan June 2012
    Posts: 35
    I really hope someone can enlighten me.  This is a Phonegap/Cordova app.  I'm currently running on iOS although this is also an Android project.

    1.
    First on one card I've a mailto: link.  This doesn't seem to be takign clicks/taps.  On mobile safari I only need to tap a link like that and the mail program on my iphone will open up.  This doesn't seem to be working.

    Am I missing something? I'll need to do this on iOS and Android.

    2.
    I'd like the user to be able to select text of elements.  For example I use joCaption and joTitle to display some text to the user, sometimes I use joHTML. In this case it's a credit card number that is displayed after a user enters a password.  It's fairly important they can copy this text to clipboard for use elsewhere outside my app.

    How come I can tap-highlight the text on my iPhone?  Is Jo blocking this somehow or is this a phonegap thing?

    Thanks in advance,
    JP
  • jpsheridanjpsheridan June 2012
    Posts: 35

    Hello again,


    OK so I notice a CSS property -webkit-user-select is used in jo2.css.  Is this causing the user select issue thus blocking both the selecting of text and the clicking on mailto links?

    Thanks,
    JP
  • jpsheridanjpsheridan June 2012
    Posts: 35

    Hello,


    Quick update - It's partially solved now.

    1.  joHTML appears to intercept "a" link click events and fire off a selectEvent.  This is fine for certain things but what about a mailto link?  Usually you want the user to be able to click and email link and open in their respective mail client.  In the case of the iPhone this is the built-in mail app.

    How can I capture this event and fire it again for the phone to handle the mailto link?

    2.  Indeed I can set -webkit-user-select: text property on whatever elements I wish to let the user select.

    Thanks,
    JP
  • kevinwalzerkevinwalzer June 2012
    Posts: 63

    Here's how I handle mailto: links in my app:


       //e-mail data using native e-mail client
        function maildata(data) {

          if (!datastring) {
    scn.alert("Error", "Please run a domain search before e-mailing the data.");
    return;
          }

          mailstring = datastring.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, "");
          location.href = "mailto: ?&subject=Whois%20Data&body=" + mailstring;

        }
          

    Hope this helps, 

    Kevin 
  • jpsheridanjpsheridan June 2012
    Posts: 35

    Hi Kevin,


    Thanks.  I got it working pretty much right after I posted that last message, it wasn't difficult once I subscribed to the selectEvent on joHTML.

    I don't like the way it takes me out of my app to mail though.  I think there's a phonegap email composer plugin that I might look into to see what that offers.

    Cheers,
    JP
  • kscottkscott March 1
    Posts: 36

    you might look into using a cordoba plug in for the native email function.

    Here is one that I have not tried using it yet:

    http://tech.sarathdr.com/featured/social-share-plugin-for-android-cordova-2-2-0-email-sms-facebook-twitter-share/