Martynas Grauzinis Martynas Grauzinis - 3 months ago 8x
jQuery Question

Android sending sms onload JS

Hello i use this script on my landing pages, but the user needs to click a button for it to work.

<a onclick="ClickTrack('click5')" href="smsto:NR?body=TEXT" class="btn_2" >
<strong><span class="cta-clik">Click to send sms</span></strong>

Does anybody know how to make it work without button click but when website Loads?


For the redirect part, you can make a function like this:

function redirect()
    window.location.href = "smsto:NR?body=TEXT"

If you use JQuery, you could use document.ready inside your script file:


If you don't, include the script in the bottom of your page like this:

    <!-- content here -->

    document.addEventListener("DOMContentLoaded", function(event) {