问题
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_nipvep1WpPd2JXeDdJcUlNYXM/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_nipvep1WpPd2JXeDdJcUlNYXM/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