Hi, I want my users to be able to enter a www. address and
- see it in webview if the www. accepts it
- or display a link.
Is there a way to automatically check that webview works for a given www.?
Thanks
Hi, I want my users to be able to enter a www. address and
Is there a way to automatically check that webview works for a given www.?
Thanks
Webview is for embedding into the app , link to reach an app starting from the app , i have to say that Glides manages the external link quite well writing âloading while it loads and putting a shortcut in the left upper side that makes the external link and the user experience to look like as within the app .Both rely on how fast is the service youâre calling there ,so optimizing with gtmetrix for example is king!.
Thank you @Manu_Marea.
My question was not clear enough: in some case, external websites cannot be displayed via webview (I suppose that it is due to restrictions that these websites put in their code).
In this case, we should enable our users to access this external website via a âlink componentâ.
My objective is to display either a âwebview componentâ or a âlink componentâ according to the possibility (or not) of displaying the external website in webview.
â But, is it possible to test upfront if an url (that I donât know since entered by the user) will be displayed in webview?
Thanks
ok , its clear , thanks
I canât think of any way to do it with Glide, but it could be done with a bit of Apps Script - which would of course mean a delayâŚ
Thank you @Darren_Murphy, I will have a look !
Hi, in case some want to check if the Webview component is authorized by a website (to avoid displaying the âgreyâ screen), the following script enables it. Once the status is indicated, we can use âvisibility conditionsâ to display or not the webview component.
I use it in Google Sheet with my âurlâ being in column K (cf. 11 below) and the returned âstatusâ being in column AP (cf. 42 below).
NB: it is probably feasible to use it in Google TableâŚ
I hope this is clear and helpsâŚ
function runBis() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(âAI LISTâ);
const lastRow = sheet.getLastRow();
const scriptProperties = PropertiesService.getScriptProperties();
const checkpoint = parseInt(scriptProperties.getProperty(âCHECKPOINTbisâ) || â2â);
console.log(Starting at checkpoint: ${checkpoint}, lastRow: ${lastRow}
);
const numRowsToProcess = 150; // Number of rows to process in each run
const endRow = Math.min(checkpoint + numRowsToProcess - 1, lastRow);
const statusUpdates = ;
for (let i = checkpoint; i <= endRow; i++) {
const urlCell = sheet.getRange(i, 11);
const statusCell = sheet.getRange(i, 42);
const url = urlCell.getValue();
const status = statusCell.getValue();
console.log(`Processing row: ${i}, url: ${url}, status: ${status}`);
if (url && !status) {
const xFrameOptions = getXFrameOptionsBis(url);
if (xFrameOptions === "DENY" || xFrameOptions === "SAMEORIGIN") {
statusUpdates.push({row: i, status: 'iFrame KO'});
} else {
statusUpdates.push({row: i, status: 'iFrame OK'});
}
}
}
// Batch update the status column
if (statusUpdates.length > 0) {
const statusRange = sheet.getRange(statusUpdates[0].row, 42, statusUpdates.length, 1);
const statusValues = statusUpdates.map(update => [update.status]);
statusRange.setValues(statusValues);
}
scriptProperties.setProperty(âCHECKPOINTbisâ, (endRow + 1).toString());
}
function getXFrameOptionsBis(url) {
try {
const response = UrlFetchApp.fetch(url, { muteHttpExceptions: true, followRedirects: false });
const headers = response.getHeaders();
if ('x-frame-options' in headers) {
return headers['x-frame-options'].toUpperCase();
}
if ('X-Frame-Options' in headers) {
return headers['X-Frame-Options'].toUpperCase();
}
} catch (e) {
// Error fetching URL
}
return âiFrame OKâ; // Return âiFrame OKâ if the headers do not contain any âx-frame-optionsâ information
}
function createTrigger() {
ScriptApp.newTrigger(ârunBisâ)
.timeBased()
.everyMinutes(10) // Run every 10 minutes
.create();
}