Hello. I have used the script extension to get the URL stored in the URL field of the currently selected record. I am using the button field to send the URL to the script but ideally, I would want to just click on a record and the extension identifies the currently selected record. However, when I try to output the URL from the record in an iFrame, I simply get the HTML code for the iFrame in my output. How can I display the actual website? I know it is possible because the "URL Preview" extension built by Airtable is able to display some webpages.
Here's a screenshot of what my output looks like:
And here is my code:
let MyTable = base.getTable("Shopping List");
let field = MyTable.getField('URL');
// When run from a button field, the script skips the prompt
// and automatically uses the button's record.
let Record = await input.recordAsync('Choose a record', MyTable);
// @TS11-ignore
let Link = Record.getCellValue(field);
// Display the iframe in the scripting extension output
var HTMLCode = '<!DOCTYPE html><html><head><title>Display Website in Iframe</title></head><body><iframe width="560" height="315" src="${Link}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></body></html>';
output.markdown(HTMLCode);