简体   繁体   English

无法使用inAppBrowser打开URL

[英]Cannot open url with inAppBrowser

I have been hacking away at this app for awhile now in xcode. 我已经用xcode破解了这个应用程序一段时间了。 I have built several html pages and integrated the inAppBrowser so url's open in the devices default browser. 我建立了几个html页面并集成了inAppBrowser,因此url在设备默认浏览器中打开。 This works perfect on all my other pages but when I try to do the same thing with this particular page, the url never opens? 这在我所有其他页面上都可以正常使用,但是当我尝试对该特定页面执行相同操作时,URL永远不会打开? I feel like this is a javascript error but my JS knowledge is very minimum at best. 我觉得这是一个JavaScript错误,但是我的JS知识充其量是最少的。

How can I get the url to open on this particular page with inAppBrowser like it does on the other ones? 我怎样才能像使用其他应用程序一样使用inAppBrowser在该特定页面上打开该URL? Nothing is different except this page has its own JS for playing media. 没有什么不同,除了此页面具有其自己的用于播放媒体的JS。

Any help would be greatly appreciated. 任何帮助将不胜感激。 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>

After further troubleshooting I found out that this is the problem: 经过进一步的故障排除后,我发现这是问题所在:

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

So now I have found a work around and all is resolved. 所以现在我找到了解决方法,所有问题都解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM