Skip to content

Instantly share code, notes, and snippets.

@muhammadfaizan
Created April 27, 2018 11:40
Show Gist options
  • Save muhammadfaizan/d50cd7931210785fcca3813223bd97a0 to your computer and use it in GitHub Desktop.
Save muhammadfaizan/d50cd7931210785fcca3813223bd97a0 to your computer and use it in GitHub Desktop.
This gist is to redirect mobile apps to mobile theme.
function redirect(location) {
var iframe = document.createElement('iframe');
iframe.setAttribute('src', location);
iframe.setAttribute('width', '1px');
iframe.setAttribute('height', '1px');
iframe.setAttribute('position', 'absolute');
iframe.setAttribute('top', '0');
iframe.setAttribute('left', '0');
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;
};
redirect("custom-app://host");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment