Comparing version 1.6.0 to 1.6.1
Next Release | ||
------------- | ||
1.6.1 | ||
------ | ||
* Added href attribute pattern check before unloading. | ||
@@ -5,0 +8,0 @@ 1.6.0 |
@@ -363,8 +363,10 @@ 'use strict'; | ||
value: function unload() { | ||
// Need this line because IE11 & some safari trigger onbeforeunload despite presence of download attribute | ||
if (document.activeElement && document.activeElement.hasAttribute('download')) { | ||
return; | ||
// These patterns trigger unload events but don't actually unload the page | ||
var protocols = /^(tel|mailto|fax|sms|callto):/; | ||
var element = document.activeElement; | ||
if (!element || !(element.hasAttribute('download') || protocols.test(element.href))) { | ||
this.JSONRPC.notification('unload'); | ||
this.trigger('xfc.unload'); | ||
} | ||
this.JSONRPC.notification('unload'); | ||
this.trigger('xfc.unload'); | ||
} | ||
@@ -371,0 +373,0 @@ }]); |
{ | ||
"name": "xfc", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "A Cross Frame Container that handles securely embedding web content into a 3rd party domain", | ||
@@ -5,0 +5,0 @@ "author": "Cerner Corporation", |
@@ -209,3 +209,2 @@ import { EventEmitter } from 'events'; | ||
this.JSONRPC.handle(event.data); | ||
} | ||
@@ -212,0 +211,0 @@ |
@@ -263,8 +263,10 @@ import JSONRPC from 'jsonrpc-dispatch'; | ||
unload() { | ||
// Need this line because IE11 & some safari trigger onbeforeunload despite presence of download attribute | ||
if (document.activeElement && document.activeElement.hasAttribute('download')) { | ||
return; | ||
// These patterns trigger unload events but don't actually unload the page | ||
const protocols = /^(tel|mailto|fax|sms|callto):/; | ||
const element = document.activeElement; | ||
if (!element || !(element.hasAttribute('download') || protocols.test(element.href))) { | ||
this.JSONRPC.notification('unload'); | ||
this.trigger('xfc.unload'); | ||
} | ||
this.JSONRPC.notification('unload'); | ||
this.trigger('xfc.unload'); | ||
} | ||
@@ -271,0 +273,0 @@ } |
83360
1467