
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 12:42 PM
My use case is this - I will have a macro displayed on an Incident form, and the macro will have an <a> tag, with hyperlink. Now, the hyperlink is a "tel:{phonenumber}" style link, intended to launch Skype or whatever to place a phone call.
The link works great - except for when you have entered data into the form, and NOT saved. When you click the link, the browser thinks you are navigating away, and thus asks if you really want to proceed. I want it to NOT do this, because "tel:" links would not actually send the browser anywhere, so the message is misleading.
Any ideas? I can share some screenshots if that doesn't make sense.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 04:24 PM
The message that is being thrown is coming from the onbeforeunload event. You can bypass it for just "tel:" links by making a UI Macro like this.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
jQuery(function($)
{
//store onbeforeunload for later use
$(window).data('beforeunload',window.onbeforeunload);
//remove||re-assign onbeforeunload on hover
$('a[href^="tel:"]')
.hover(
function(){window.onbeforeunload=null;},
function(){window.onbeforeunload=$(window).data('beforeunload');}
);
}
);
</script>
<p>Just call us at <a class="cssclassname" href="tel:18005555555"
title="CLICK TO DIAL - Mobile Only">(800) 555-5555</a>.</p>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 04:24 PM
The message that is being thrown is coming from the onbeforeunload event. You can bypass it for just "tel:" links by making a UI Macro like this.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
jQuery(function($)
{
//store onbeforeunload for later use
$(window).data('beforeunload',window.onbeforeunload);
//remove||re-assign onbeforeunload on hover
$('a[href^="tel:"]')
.hover(
function(){window.onbeforeunload=null;},
function(){window.onbeforeunload=$(window).data('beforeunload');}
);
}
);
</script>
<p>Just call us at <a class="cssclassname" href="tel:18005555555"
title="CLICK TO DIAL - Mobile Only">(800) 555-5555</a>.</p>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2016 01:00 PM
That's a really great solution - I never would have thought of that! I pasted that snippet into my macro and it works great.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2016 11:35 PM
Can't you just put a target="_blank" in the hyperlink so it won't be opened in the same context?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2016 09:11 AM
target="_blank" will avoid the onbeforeunload event but it will open a new tab with the address tel:555-555-5555 and then trigger a telephone app. If you don't mind the extra tab getting opened then that will work too.