cancel
Showing results for 
Search instead for 
Did you mean: 

Is it recommended to use Iframe for document Preview?

Aastha
Explorer
0 Kudos

Hi Colleagues,

I have various documents (docx, txt, pdf, ppt, xslx) that i would like to open in a preview mode.

The only Viewer control i could find in UI5  was for Pdf( PDF Viewer).

The first solution that came up was using iframe tag of sap.ui.core.HTML to embed the document :

var oHtml = new sap.ui.core.HTML();

oHtml .setContent("<div  style='width: 100%; height: 100%; overflow:scroll' ><iframe id='tcf' style='width: 500px; height: 500px; overflow:scroll' src='http://help.sap.com/hana/hana_dev_en.pdf'></iframe></div>");

        

Just want to understand, is it advisable to use iframe to preview documents? Are there any security issues with its usage?

Your help is appreciated.

Thanks,

Aastha

View Entire Topic
vijay_kumar49
Active Contributor
0 Kudos

Look its correct

  1. createContent : function(oController) { 
  2.             var html = new sap.ui.core.HTML(); 
  3.             html.setContent("<div id=\"divPdf\"><iframe id='pdfFrame' style=\"height:1000px;\"></iframe>"); 
  4.             return new sap.m.Page({ 
  5.                   title : "PDF View"
  6.                   showNavButton : true
  7.                   navButtonPress : oController.fnGoback, 
  8.                   content : [ html ], 
  9.                   footer : new sap.m.Bar({ 
  10.                   }) 
  11.             }); 
  12.       } 


Example application Example-1  and Example-2 and Example-3

Kindly let me know if you need any information

Aastha
Explorer
0 Kudos

Hi Vijay,

Thanks for your response. But, I am not looking for iframe examples. Just want to understand whether it is recommended to use iframes. Are there any security loopholes with using iframes?

Regards,

Aastha

vijay_kumar49
Active Contributor
0 Kudos

As per my understand, there is no security issues. you can use