无法使用应用程序浏览器打开 url

Cannot open url with inAppBrowser

本文关键字:url 浏览器 应用程序      更新时间:2023-09-26

我已经在xcode中破解这个应用程序一段时间了。 我已经构建了几个 html 页面并集成了 inAppBrowser,因此 url 在设备默认浏览器中打开。 这在我的所有其他页面上都非常有效,但是当我尝试对这个特定页面做同样的事情时,网址永远不会打开? 我觉得这是一个javascript错误,但我的JS知识充其量是最低限度的。

如何让网址像在其他页面上一样使用 inAppBrowser 在此特定页面上打开? 除了这个页面有自己的用于播放媒体的JS之外,没有什么不同。

任何帮助将不胜感激。 感谢

<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
            <meta name="viewport" content="width=device-width, user-scalable=no" />

        <!-- <link rel="stylesheet" href="css/index.css"> -->
        <title>My App</title>

        <style>
            * {
                -webkit-touch-callout: none;
                -webkit-user-select: none;
            }
            </style>

    </head>
    <body>

        <script type="text/javascript" src="cordova.ios.js"></script>

        <script type="text/javascript" charset="utf-8" src="video.js"></script>
        <script type="text/javascript">
            function playbeachcam(){
                document.getElementById('bankschanneldiv').style.display= "none";
                document.getElementById('beachcamdiv').style.display= "block";
                document.getElementById('looperscamdiv').style.display= "none";

               // window.plugins.videoPlayer.play("http://.../playlist.m3u8");
            }
            function playloopercam(){
                document.getElementById('bankschanneldiv').style.display= "none";
                document.getElementById('beachcamdiv').style.display= "none";
                document.getElementById('looperscamdiv').style.display= "block";

               // window.plugins.videoPlayer.play("http://.../playlist.m3u8");
            }
            function playbankcam(){
                document.getElementById('bankschanneldiv').style.display= "block";
                document.getElementById('beachcamdiv').style.display= "none";
                document.getElementById('looperscamdiv').style.display= "none";
                //window.plugins.videoPlayer.play("http://.../playlist.m3u8");
            }
            function openHome() {
                var ref = window.open('http://www.google.com/', '_blank', 'location=yes');
                ref.addEventListener('loadstart', function() { alert('start: ' + event.url); });
                ref.addEventListener('loadstop', function() { alert('stop: ' + event.url); });
                ref.addEventListener('exit', function() { alert(event.type); });
            }
            </script>

        <div class="header-container" data-role="header">

            <div style=" text-align:left;margin-left:15px;">
                <a href="index.html" style="text-decoration:none;"><img style="width: 59px; height: 50px" src="img/wbl-logo.png" />
                    <span style="width:auto;position:absolute;bottom:25%;margin-left:10px;font-size:22px;color:#07a54a;">My App</span></a>
            </div> <!-- end logo -->
            <div style="text-align:right;width:auto;position:absolute;right:5%;top:30%;">
                <a class="ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-up-c" data-inline="true" data-transition="slide" data-role="button" href="#menu" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="c">
                    <span class="ui-btn-inner ui-btn-corner-all">
                        <span class="ui-btn-text" style="color:#0267a6;">MENU</span>
                    </span>
                </a>
            </div><!-- end menu -->
        </div><!-- end header -->
        <div class="content-container" data-role="content">
            <div id="wrapper" style="bottom:5px;">
                <div id="main-content">

                    <button id="BeachCam" onClick="playbeachcam();" >
                        Play Beach Cam
                    </button>
                    <br/>
                    <button id="LooperStar" onClick="playloopercam();">
                        Play Looper Cam
                    </button>
                    <br/>
                    <button id="BanksChannel" onClick="playbankcam();">
                        Play Banks Cam
                    </button>

                    <div id = "bankschanneldiv" style="display:none;">
                        <video
                            id="mediaplayer1"
                            controls="1"
                            autoplay="1"
                            height="218"
                            preload="none"
                            src="http://.../playlist.m3u8"
                            width="100%">
                        </video>
                    </div>
                    <div id = "beachcamdiv" style="display:none;">
                        <video
                            id="mediaplayer2"
                            controls="1"
                            autoplay="1"
                            height="218"
                            preload="none"
                            src="http://.../playlist.m3u8"
                            width="100%">
                        </video>
                    </div>
                    <div id = "looperscamdiv" style="display:none;">
                        <video
                            id="mediaplayer3"
                            controls="1"
                            autoplay="1"
                            height="218"
                            preload="none"
                            src="http://.../playlist.m3u8"
                            width="100%">
                        </video>
                    </div>


                    <p style="color:#f4f4f4;">Having Trouble?</p>
                    <p><a style="color:#07a54a;text-shadow:1px 1px 1px #333;" href="#" onclick='openHome()' target="_blank" >View the cams on our website</a></p>

                </div>
            </div>
        </div>
        <div class="footer ui-bar-a" data-role="footer" role="contentinfo">
            <div style="text-align:center;width:auto;margin:10px 0;">
                <a href="#" onclick='openHome()' target="_blank" style="text-decoration:none;color:#291e0f;">My Footer </a>
            </div> <!-- end footer content -->

        </div><!-- end footer -->

    </body>
</html>

经过进一步的故障排除,我发现这就是问题所在:

<script type="text/javascript" src="cordova.ios.js"></script>

所以现在我找到了解决方法,一切都解决了。