Email Share Link is not encoded properly

I just noticed an issue with the current Email Share Link.

When inspecting the link from the HTML, the link looks like this:
href=“mailto:?subject=&body=https://domain.com/posttype/postslug/” rel=“noopener” target=“_blank”

This works fine on standard browser but not for the web view let’s say on the App environment.

For our findings, the link should be encoded, something like this to support both standard and webview:
href=“mailto:?body=https%3A%2F%2Fdomain.com%2Fposttypes%2Fpostslug%2F”

Not sure if this is a quick fix on Cwicly’s end? Thanks!

Hi @lukelee,

Thank you for bringing this up!

We’ll be taking a closer look at this when possible, so I’ll let @Louis confirm this once we have taken a thorough look.

Thank you for your understanding.

Thank you @Araminta !

We did a fix on our end by coding a new function to create a shortcode for an email sharing button.

Here is our code, not sure if this can be helpful for your inspection:

function email_share_button_shortcode($atts) {
// Extract attributes from the shortcode
extract(shortcode_atts(array(
‘url’ => ‘’, // The URL to be shared
‘text’ => ‘Share via Email’, // Default button text
), $atts));

// If no URL is provided, get the current post's URL
if (empty($url) && is_singular()) {
    global $post;
    $url = get_permalink($post);
}

// Return the formatted HTML for the button with JavaScript behavior
return "<a data-dynamic-mail class='email social' target='_blank' title='Share via email' href='javascript:void(0);' onclick=\"window.open('mailto:?subject=' + encodeURIComponent(document.title) + '&body=' + encodeURIComponent('$url')); return false;\">
            <div id='icon-cc1c3e3' class='icon-c32fdbb icon-ca62a4a cc-icn'><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path d='M26 23.5v-12c-0.328 0.375-0.688 0.719-1.078 1.031-2.234 1.719-4.484 3.469-6.656 5.281-1.172 0.984-2.625 2.188-4.25 2.188h-0.031c-1.625 0-3.078-1.203-4.25-2.188-2.172-1.813-4.422-3.563-6.656-5.281-0.391-0.313-0.75-0.656-1.078-1.031v12c0 0.266 0.234 0.5 0.5 0.5h23c0.266 0 0.5-0.234 0.5-0.5zM26 7.078c0-0.391 0.094-1.078-0.5-1.078h-23c-0.266 0-0.5 0.234-0.5 0.5 0 1.781 0.891 3.328 2.297 4.438 2.094 1.641 4.188 3.297 6.266 4.953 0.828 0.672 2.328 2.109 3.422 2.109h0.031c1.094 0 2.594-1.437 3.422-2.109 2.078-1.656 4.172-3.313 6.266-4.953 1.016-0.797 2.297-2.531 2.297-3.859zM28 6.5v17c0 1.375-1.125 2.5-2.5 2.5h-23c-1.375 0-2.5-1.125-2.5-2.5v-17c0-1.375 1.125-2.5 2.5-2.5h23c1.375 0 2.5 1.125 2.5 2.5z'></path></svg></div>
        </a>";

}
add_shortcode(‘email_share_button’, ‘email_share_button_shortcode’);

Obviously I did some html output there to match the style I want, but the code should explain itself clearly.

This shortcode works on both standard browser and in web view on IOS.

2 Likes

Hi,

We have fixed this issue in 1.3.0.3.

Please let us know if you are still experiencing issues once updated.

Best regards,
Johnny