javascript - refresh iframe after downloading a blob -
i have filebrowser on server uses azure storage store files. website has feature when click on file, it'll bring details window. use viewerjs display pdf preview of file (if applicable), , works pretty well. problem when downloading preview file, have reload preview iframe manually display. relevant php function is:
http://pastebin.com/sayhsbfi
when function completed (i'm using ajax), $.done
function calls
response = json && json.parse(response) || jquery.parsejson(response);
$scope.pdfthingy=response;
document.getelementbyid("viewerjs_preview").contentdocument.location.reload(true);
response
on first line set full pathname pdf preview file, , viewerjs_preview
id of relevant iframe.
reason, isn't working, , iframe isn't reloading itself. how make when blob has finished downloading, , pdfthingy set?
is iframe’s domain same host website’s domain? if not, cannot access contentdocument (or contentwindow) in host website’s javascript code.
to refresh iframe, per understanding can set src:
document.getelementbyid('viewerjs_preview').src = document.getelementbyid('viewerjs_preview').src;
please note if src contains hash tag, may need additional work. i’d suggest check what's best way reload / refresh iframe using javascript? more information.
Comments
Post a Comment