You can try placing the URL in the binding element and checking the protocol:
var anchor = document.createElement("a"); anchor.href = redirectUrl; if(anchor.protocol != "javascript:") { window.localtion.href = redirectUrl; }
However, I'm not sure how good browser support is for this, since MDN lists it as an HTML5 function.
source share