Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
HTML with JS not working properly in some browsers

The code below which I found here

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <script type="text/javascript">
            window.onload = function() {

                var desktopFallback = "https://youtube.com/watch?v=4KnNVK-udTU",
                mobileFallback = "https://youtube.com/watch?v=4KnNVK-udTU",
                app = "vnd.youtube://4KnNVK-udTU";

                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>
    </body>
</html>

Is supposed to open youtube app based on the device. If it's a mobile device's browser through which the file was opened, the video must open up in the app. The code works fine in browser like FireFox. But it is not working on chrome. The app is not being opened, instead the browser version of youtube is being opened. That implies the mobilefallback link is being called, which is not I want.

And also if clicked from somewhere it works fine. The problem is only with Chrome. I don't know if it's some kind of chrome feature...but this is not what I need. Any help? I can use any kind of solution. Even some other way to open up links like vnd.youtube://4KnNVK-udTU this directly in app.

Sorry if this info is not enough...I'll provide whatever it takes for you to help me out. ThankYou :)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!