summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-03-21 18:32:04 +0100
committerThomas Bruederli <thomas@roundcube.net>2014-03-21 18:33:19 +0100
commit5934e238242cb0d96e128bfad3905809b5aeb093 (patch)
tree4bff16b02d22ee55ee009cd1d17b30bba95f798b /program/js
parente5bb1357a5bad2f5ed9b488425d6b195296ca595 (diff)
Disable link registering mailto: protocol handler if not supported by the browser (#1489569)
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 605df57fa..f9d4bb056 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -7510,20 +7510,28 @@ function rcube_webmail()
try {
window.navigator.registerProtocolHandler('mailto', this.mailto_handler_uri(), name);
}
- catch(e) {};
+ catch(e) {
+ this.display_message(String(e), 'error');
+ };
};
this.check_protocol_handler = function(name, elem)
{
var nav = window.navigator;
- if (!nav
- || (typeof nav.registerProtocolHandler != 'function')
- || ((typeof nav.isProtocolHandlerRegistered == 'function')
- && nav.isProtocolHandlerRegistered('mailto', this.mailto_handler_uri()) == 'registered')
- )
- $(elem).addClass('disabled');
- else
- $(elem).click(function() { rcmail.register_protocol_handler(name); return false; });
+ if (!nav || (typeof nav.registerProtocolHandler != 'function')) {
+ $(elem).addClass('disabled').click(function(){ return false; });
+ }
+ else {
+ var status = null;
+ if (typeof nav.isProtocolHandlerRegistered == 'function') {
+ status = nav.isProtocolHandlerRegistered('mailto', this.mailto_handler_uri());
+ if (status)
+ $(elem).parent().find('.mailtoprotohandler-status').html(status);
+ }
+ else {
+ $(elem).click(function() { rcmail.register_protocol_handler(name); return false; });
+ }
+ }
};
// Checks browser capabilities eg. PDF support, TIF support