<script type="text/javascript">
window.onload = function() {
//Pega o ID do YT pelo parâmetro ID=
var url_string = window.location.href;
var url = new URL(url_string);
var ytID = url.searchParams.get("id");
var desktopFallback = "https://www.youtube.com/watch?v=" + ytID,
mobileFallback = "https://www.youtube.com/watch?v="+ ytID,
app = "vnd.youtube://" + ytID;
if( /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) ) {
window.location = app;
window.setTimeout(function() {
window.location = mobileFallback;
}, 25);
} else {
window.location = desktopFallback;
}
function killPopup() {
window.removeEventListener('pagehide', killPopup);
}
window.addEventListener('pagehide', killPopup);
};
</script>