Skip to main content

How to preview doc or docx file in html/iFrame?

Preview doc or docx file in html/iFrame

var link = "paste docx file link here";
var iFrameUrl = 'https://view.officeapps.live.com/op/embed.aspx?src=' + link + '&embedded=true';

$('#documentModalIframe').attr('src',iFrameUrl);

or

<iframe src="https://docs.google.com/gview?url=http://remote.url.tld/path/to/document.doc&embedded=true"></iframe>

Comments

Popular posts from this blog

How to check date format in PHP?

Check date format in PHP function isCorrectDateFromat($date){     if(!empty($date)){         $dateString = $date; // Replace this with your date string         $format = "Y-m-d"; // Replace this with your expected date format         $dateTime = DateTime::createFromFormat($format, $dateString);         if ($dateTime === false) { /*             echo "The date is not in the correct format."; */         } else {             $errors = DateTime::getLastErrors();             if (empty($errors)) { /*                 echo "The date is in the correct format."; */                 return true;             } else { /*                 echo "...