From 518612834b4e94a61bdc4b9ec8d043662964f9e7 Mon Sep 17 00:00:00 2001 From: winsontam Date: Wed, 30 Jul 2014 11:12:55 +0800 Subject: [PATCH] fix($location) solve when url is "javascript:" or "mailto:" When url is started with "javascript:" or "mailto:" It still do the redirect. --- src/ng/location.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ng/location.js b/src/ng/location.js index 1d99e9b2ea21..1a5de48d47cd 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -650,6 +650,9 @@ function $LocationProvider(){ } var absHref = elm.prop('href'); + + // Ignore when url is started with javascript: or mailto: + if (absHref.toString().indexOf('javascript:') === 0 || absHref.toString().indexOf('mailto:') === 0) return; if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') { // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during