通过IONIC Native InAppBrowser隐藏位置工具栏

acr*_*uma 9 webview cordova inappbrowser ionic-framework

阅读appovabrowser中cordova文档,我找不到隐藏“位置工具栏”的方法(总是并且当它具有“ location = yes”时),并且仅对于Android,因为我们可以在IO上使用“ toolbar = no”。

为什么需要活动的“位置=是”?您可以输入“ no”,它不再出现。

当我在此线程中评论时,我需要激活的选项才能使用离子本机IAB的功能

我使用的选项:

location=yes,
EnableViewPortScale=yes,
hidenavigationbuttons=yes,
enableViewportScale=yes,
hideurlbar=yes,
zoom=no,
mediaPlaybackRequiresUserAction=yes,
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

正如我们在图像中看到的,工具栏仍显示在顶部。

有没有被忽视的选择?是否可以使用CSS删除它,如果有,它是否可以调用任何类或ID,还是应该用纯代码触摸它?

Pri*_*ish 2

对于ios来说,如果您正在查看 .html 或 .pdf 文件,它会隐藏地址栏,请使用此代码来实现,并getFileExtension从您的代码中调用此函数。

function getFileExtension(filename) {
           var fileName = filename.split('.').pop();
           if (fileName == 'pdf')
           {
               viewLinkpdf(filename)
           }
           else 
           {
               viewLink(filename)
           }
       }
       function viewLink(filepath) {
            var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
            var win = window.open( url, "_blank", "location=no" );
       }

function viewLinkpdf(filepath) {
           var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
            window.open(encodeURI('https://docs.google.com/gview?embedded=true&url='+url), '_blank', 'location=no,EnableViewPortScale=yes');
       }
Run Code Online (Sandbox Code Playgroud)

与Android类似,但有非常小的变化

function viewLinkpdf(filepath) {
        var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
        window.open(encodeURI('https://docs.google.com/gview?embedded=true&url='+url), '_blank', 'location=no,EnableViewPortScale=yes');
    }
    function getFileExtension(filename) {
        var fileName = filename.split('.').pop();
        if (fileName == 'pdf')
        {
            viewLinkpdf(filename)
        }
        else 
        {
            viewLink(filename)
        }
    }
    function viewLink(filepath) {
        var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
        var options = {
            location: 'no',
            clearcache: 'yes',
            toolbar: 'no'
        };
        $cordovaInAppBrowser.open(url, '_blank', options)
        .then(function (event) {
            // success
        })
        .catch(function (event) {
            // error
        });
    }
Run Code Online (Sandbox Code Playgroud)

我将这两个代码放在这里可能是您想要的重复捕获它。我希望这能帮到您。