I have an iframe in which I want to put a preview of my pdf document hosted in firebase storage through google docs viewer. I am creating the html view in javascript dynamically and adding it by jquery's ('.someClass').html()
method.
I tried to plug in the download url of the document to the iframe directly and it works just fine and displays the preview.
But I can't get it to display the preview through google docs.
What I meant is that this works just fine:
....making my html on the fly in javascript
myHtml+='<iframe src="'+downloadUrlFirebaseStorage+'" width="100%" frameborder="0"/>'
....making remaining rest of my html on the fly in javascript
$('.someClass').html(myHtml);
But this gets me an error:
....making my html on the fly in javascript
myHtml+='<iframe src="https://docs.google.com/viewer?url='+downloadUrlFirebaseStorage+'&embedded=true" width="100%" frameborder="0"/>'
....making remaining rest of my html on the fly in javascript
$('.someClass').html(myHtml);
The error I get is this:
Refused to display 'https://docs.google.com/gview?url=https://firebasestorage.googleapis.com/v0/b/habiganjmedicalcollege.appspot.com/o/documents%2FSampleDoc.pdf?alt=media&token=51df7c93-0c59-46a4-9229-267bc527705b%26embedded=true' in a frame because it set 'X-Frame-Options' to 'sameorigin'