Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Deeplink Youtube
<!DOCTYPE html>
<meta charset="utf-8">
<script type="text/javascript">
window.onload = function() {
var desktopFallback = "",
mobileFallback = "",
app = "";
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);
Copy link

click2jit commented Jan 18, 2019

Thank You..

Copy link

sajornad commented May 9, 2019

Best help!


Copy link

lumyjuwon commented Sep 16, 2019

Oh my god .. Thank you ..

Copy link

sanjeev28 commented Jan 16, 2020

Well Done bro! Very Nice job. Buddy can you share a code to check browser in the phone and open the link in that app.Similar to this code but at the place of youtube it could be a browser and the place of channel link,it could be a website url.

Copy link

mubaid commented May 7, 2020

Doesnt seem to be working anymore? Just tried on Android Chrome/Brave/Firefox.. It opens the YT video in the browser itself.

Copy link

Mohammed-Nasser commented Oct 27, 2020

Thank You.. it working

Copy link

YasserTamer commented Nov 21, 2020

It works fine with me as well. But when I share it, it appear as coming from my domain. While people using professional deep linking portal the link appear as being from youtube with the same Thumbnail. I wonder if the code can be modified so the shared post looks the same

Copy link

benjaminwtwall commented Mar 7, 2021

Looking for a way to deeplink YT for free, found this. So does this need to be hosted on a domain and then will take the viewer straight to the app?

Copy link

bassel999 commented Apr 3, 2021

The code is working great
But only on chrome browser on Android it will not work.
Any advice?

Copy link

M7ammad-eb commented Jun 21, 2021

This is great, thanks.
I've been using it for a while, it worked perfectly, now it's working except on Facebook, it doesn't even fallback to the webpage, just loads white blank page! Any ideas?

Copy link

viwicodes commented Sep 18, 2021

Can we do something like this for other apps? Like Instagram, Facebook, Twitter etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment