How can I hide the heading and options bar in google drive

为君一笑 提交于 2019-12-23 05:02:04

问题


I want to hide the top options bar in google drive. How can I achieve that? I am using cordova inAppBrowser to open this link.

https://drive.google.com/file/d/0B_nipvep1WpPd2JXeDdJcUlNYXM/view

I want to use embedded=true but I don't know how it would work. Please see the image below.


回答1:


May be this will help you

You have to wait until your inAppBrowser page loading finishes.

//Set css in your inAppstyle.css
.drive-viewer-toolstrip{
    display: none !important;
    opacity: 0 !important;
}

You must add an event listener:

var inApp = window.open('https://drive.google.com/file/d/0B_nipvep1WpPd2JXeDdJcUlNYXM/view', '_blank', 'location=no');
inApp.addEventListener('loadstop', function(){
    inApp.insertCSS({
        file: 'inAppStyle.css'
    },onSuccess);
});

Use this path for your android projects file:///android_asset/{your folder}

INFO: https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md#android-file-system-layout

Your JS

text += '<a href="javascript:void(0)" class="embedURL" onClick="cordova.InAppBrowser.open(\'drive.google.com/file/d‌​/0B_nipvep1WpPd2JXeD‌​dJcUlNYXM/view\', \'_blank\', \'location=no\')">' + data.docs[i].doc_title + '</a>'; 

Updated JS

text += '<a href="javascript:void(0)" class="embedURL" onClick="openthislink(\'drive.google.com/file/d‌​/0B_nipvep1WpPd2JXeD‌​dJcUlNYXM/view\')">' + data.docs[i].doc_title + '</a>';

//Create new function
function openthislink(ln)
{
    var inApp = window.open(ln, '_blank', 'location=no');
    inApp.addEventListener('loadstop', function(){
        inApp.insertCSS({
            file: 'inAppStyle.css'
        },onSuccess);
    });
}


来源:https://stackoverflow.com/questions/39892497/how-can-i-hide-the-heading-and-options-bar-in-google-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!