InAppBrowser没有在带有cordova 3.3.0的ios6上显示工具栏

时间:2014-01-15 10:53:38

标签: ios cordova inappbrowser

我使用Xcode 5,Cordova 3.3.0。插件已通过命令行安装(cordova插件添加org.apache.cordova.inappbrowser)。

我使用ios6在Ipad2上测试,在ios7的模拟器上测试。

打开html文件或pdf文件没有任何问题,但我没有ToolBar / Location Bar或其他。

关闭pdf以便在上一页返回!!!

我可以再次检查什么?我该怎么做才能解决这个问题?

提前感谢您的帮助; - )

我的html文件的内容:

<!DOCTYPE html>
<html>
    <head>
        <title>InAppBrowser.removeEventListener Example</title>

        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
        <script type="text/javascript" charset="utf-8">

        // Wait for device API libraries to load
        //
        document.addEventListener("deviceready", onDeviceReady, false);

        // Global InAppBrowser reference
        var iabRef = null;

        function iabLoadStart(event) {
            alert(event.type + ' - ' + event.url);
        }

        function iabLoadStop(event) {
            alert(event.type + ' - ' + event.url);
        }

        function iabLoadError(event) {
            alert(event.type + ' - ' + event.message);
        }

        function iabClose(event) {
            alert(event.type);
            iabRef.removeEventListener('loadstart', iabLoadStart);
            iabRef.removeEventListener('loadstop', iabLoadStop);
            iabRef.removeEventListener('loaderror', iabLoadError);
            iabRef.removeEventListener('exit', iabClose);
        }

        // device APIs are available
        //
        function onDeviceReady() {

        }

        function openPdf() {
            iabRef = window.open('test.pdf', '_blank', 'location=yes,toolbar=yes,transitionstyle=fliphorizontal');
            iabRef.addEventListener('loadstart', iabLoadStart);
            iabRef.addEventListener('loadstop', iabLoadStop);
            iabRef.addEventListener('loaderror', iabLoadError);
            iabRef.addEventListener('exit', iabClose);
        }

        function openHtml() {
            // open win and turn off location
            var ref = window.open('index2.html', '_blank', 'location=no');

            // attach listener to loadstart
            ref.addEventListener('loadstart', function(event) {
                var urlSuccessPage = "index2.html";
                if (event.url == urlSuccessPage) {
                    ref.close();
                }
            });
        }

        </script>
    </head>
    <body>

        <p><a href="javascript:openPdf();">PDF</a></p>
        <p><a href="javascript:openHtml();">page 2</a></p>

    </body>
</html>

我的配置文件的内容:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.antidot.testpdf2" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Hello Cordova</name>
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <name>test-pdf-2</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>
    <feature name="File">
        <param name="ios-package" value="CDVFile" />
    </feature>
    <feature name="Console">
        <param name="ios-package" value="CDVLogger" />
    </feature>
</widget>

1 个答案:

答案 0 :(得分:0)

很可能是inapp浏览器插件没有加载,而是webview。检查所有设置,看看是否实际调用了inappbrowser。