Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法使用inAppBrowser打开url_Javascript_Xcode_Cordova - Fatal编程技术网

Javascript 无法使用inAppBrowser打开url

Javascript 无法使用inAppBrowser打开url,javascript,xcode,cordova,Javascript,Xcode,Cordova,我已经在xcode中黑客攻击这个应用有一段时间了。我已经构建了几个html页面并集成了inAppBrowser,所以url在设备默认浏览器中是打开的。这在我的所有其他页面上都非常有效,但是当我尝试对这个特定页面执行相同的操作时,url永远不会打开?我觉得这是一个javascript错误,但我的JS知识充其量是非常少的 我怎样才能像在其他页面上一样,通过inAppBrowser在这个特定页面上打开url?除了这个页面有自己的用于播放媒体的JS之外,没有什么不同 任何帮助都将不胜感激。Thx <

我已经在xcode中黑客攻击这个应用有一段时间了。我已经构建了几个html页面并集成了inAppBrowser,所以url在设备默认浏览器中是打开的。这在我的所有其他页面上都非常有效,但是当我尝试对这个特定页面执行相同的操作时,url永远不会打开?我觉得这是一个javascript错误,但我的JS知识充其量是非常少的

我怎样才能像在其他页面上一样,通过inAppBrowser在这个特定页面上打开url?除了这个页面有自己的用于播放媒体的JS之外,没有什么不同

任何帮助都将不胜感激。Thx

<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>

我的应用程序
* {
-webkit触摸标注:无;
-webkit用户选择:无;
}
函数playbeachcam(){
document.getElementById('bankschanneldiv').style.display=“无”;
document.getElementById('beachcamdiv').style.display=“block”;
document.getElementById('looperscamdiv').style.display=“无”;
//window.plugins.videoPlayer.play(“http://.../playlist.m3u8");
}
函数playloopercam(){
document.getElementById('bankschanneldiv').style.display=“无”;
document.getElementById('beachcamdiv').style.display=“无”;
document.getElementById('looperscamdiv').style.display=“block”;
//window.plugins.videoPlayer.play(“http://.../playlist.m3u8");
}
函数playbankcam(){
document.getElementById('bankschanneldiv').style.display=“block”;
document.getElementById('beachcamdiv').style.display=“无”;
document.getElementById('looperscamdiv').style.display=“无”;
//window.plugins.videoPlayer.play(“http://.../playlist.m3u8");
}
函数openHome(){
var ref=窗口打开('http://www.google.com/“,”空白“,”位置=是“;
ref.addEventListener('loadstart',function(){alert('start:'+event.url);});
ref.addEventListener('loadstop',function(){alert('stop:'+event.url);});
ref.addEventListener('exit',function(){alert(event.type);});
}
玩沙滩摄影机

游隙活套凸轮
玩银行游戏 遇到麻烦了吗


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

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


因此,现在我找到了解决办法,所有问题都解决了。

标记中的源URL似乎无效:http://.../playlist.m3u8 不去任何地方。您可能是指不带http://Sorry,为了隐私,我省略了这些。他们实际上指向了我源代码中的一个实时url,但出于安全原因,我在这篇文章中省略了。不幸的是,这不是inAppBrowser无法在此特定页面中工作的原因。您希望在inAppBrowser中打开哪个URL?此外,徽标one缺少一个
target=“\u blank”
。如果从页面中删除视频JavaScript,它会像你期望的那样工作吗?例如,我只想打开Google。inAppBrowser可以在其他页面上完美运行。因此,我尝试创建一个新页面并从上面粘贴的页面链接到它,但它不起作用,但是如果我从应用程序索引页面(而不是上面粘贴的页面)链接到新页面,那么它就起作用了。所以我觉得问题出在视频javascript中,它可以很好地处理视频,但必须删除我在页面上放置的任何其他链接,无论是本地应用程序内链接还是带有InApp浏览器的链接。希望这是有意义的。只是试着对事情进行评论,看看具体的原因是什么,这就是问题所在:现在我陷入了一个解决方案,如何实施?