internet explorer - Redirect javascript failing in all but Chrome -
trying have webpage manage redirect, if deeplink fails open. if deeplink opens, great. if doesn't within 2 seconds, want go website.
<script type="javascript"> settimeout(function () { window.location = "http://mywebsite.com"; }, 25); window.location = "my://app"; </script>
i've tested in chrome , works, firefox, ie, , safari block script.
anyone have thought on how handle this?
window.location.assign("http:mywebsite.com") may improve alternative believe calling function fires additional events may create lifecycle of page easy manage.
also in except chrome can utilize iframe effort launch protocol handler. help prevent page going about:blank and/or script stopping due navigating away page.
var createiframe = function(id, url, timeout, callback) { var iframe; iframe = document.createelement("iframe"); iframe.hidden = true; iframe.id = id; iframe.src = url; var info = {} data.id = id; data.iframe = iframe; homecoming settimeout(callback, timeout, null, data); } createiframe('tempframe', 'http://mywebsite.com', 25, function(err, data) { if(!err && data){ var iframe = data.iframe; var id = data.id; iframe = document.getelementbyid(id); iframe.parent.removechild(iframe); } else { console.log('there error createing , removeing iframe'); } }
javascript internet-explorer firefox redirect safari
No comments:
Post a Comment