Forum Discussion

BarryGulino's avatar
BarryGulino
Qrew Cadet
6 years ago

Embedded web pages in a form using a formula rich text field.

I am working on a form that will use formula rich text format to display web pages on various tabs in the form.  The web pages would be specific to the data in the first tab.  For example if the data in the first tab has an address, the web page would have the address in the url.  This would save time for the user as they would not have to navigate to the web pages they could just click the tab to get the information.  It has worked well on most of the pages, but I am getting blanks or errors.  Some are fixed by changing the formula from "http:" to "https: but some I just cannot figure out.  I think it may be a web page that cannot be opened in a frame.  This is the formula I am using:

"<img data-url='" & [formula url]& "'" &
" src onerror='\n(async () => {\n  var url = this.dataset.url;\n  this.outerHTML = '<iframe src=${url} width=1150px height=600px></iframe>';\n})();\n'>"

Does anyone have a solution?
  • I do know that some websites prevent themselves from being used in an iframe.  For example they may have content and want to get the advertising revenue for themselves, and not let you use their content for free and then iframe out the advertising content and replace it with your own.

    But I don't know if there is a specific test for that aside from it just not working.
  • All the pages are public that contain no advertisements.  An example would be property tax information from the county.  If I just copy and paste the URL on a new tab, it works.  That's why I am presuming it may have something to do with the frame.
  • You can open the F12 developer console and review the Network tab, look for the Get request for that website and review the Response Headers. If you see x-frame-options: SAMEORIGIN, then that website can not be loaded into an iframe. This is prevent clickjacking attacks.

    My advice would be to give your users a button on the form that opens that website in a new window.
  • Thank you Mark and Everett, the link will have to be our option.  The reason to embed is that the web page could be right next to the fields that need to be changed or added without clicking back and forth.  Thanks againl