How to make a YouTube Deeplink

Try it yourself

Your generated code:

Copy paste the code, make a new .html file and upload this file to a public hosting service.
Then simply use the file link as your YouTube link and mobile users will always open the YouTube app!

How does it work?

In case the code generator didn't work, or you are just curious, see example below! 😊

<!DOCTYPE html>
        <meta charset="utf-8">
        <script type="text/javascript">
            window.onload = function() {
                // fallback link in case user doesn't have the app or opens link on desktop
                var fallback = "link here",
                // app to direct to youtube application, last part of link can be;
                // video: watch?v=your_id
                // channel: channel/your_id
                app = " part of link here";

                if( /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) ) {
                    window.location = app;
                    window.setTimeout(function() {
                        // couldn't open app, open fallback url
                        window.location = fallback;
                    }, 25);
                } else {
                    // open url because device doesn't support youtube app
                    window.location = fallback;

                function killPopup() {
                    window.removeEventListener('pagehide', killPopup);

                window.addEventListener('pagehide', killPopup);

It's very simple, all you must do is adding your original link in the fallback variable and adding the last part of your video or channel after in the app variable.

For app variable for videos
For app variable for channels (some have c/, which works too)

Create a new .html file and upload it to any public hosting service. This can be your personal website, but you can also use something as dropbox to upload your web file.

Put the link in your bio or link tree and all users will now redirect to the YouTube app instead of opening YouTube in the in app browser.

If you have any questions, feel free to ask in the comments below or send me a direct message on Instagram.

Happy coding! 👨‍💻

Follow Justin Scott:

I love to learn and share. - 01001010 01010011 01000010

Latest posts from

Leave a Reply

Your email address will not be published. Required fields are marked *