We are using MVC4 and added PDFTron's Web Viewer. Below is the code.
@model string
<script type="text/javascript">
var url = localStorage.g_puburl;
$(function () {
var viewerElement = document.getElementById('viewer');
alert('1 - control before webviewer load');
var myWebViewer = new PDFTron.WebViewer({
type: "html5mobile",
initialDoc: url,
config: URL("/Resources/Scripts/WebViewerConfig.js"),
enableAnnotations: true
}, viewerElement);
alert('2 - control before webviewer load');
});
</script>
<div id="viewer" style="height: 100%; "></div>
This runs find on Desktop. But on Mobile when we load WebViewer script crashes and next set of line does not execute. In Above code Alert -2 Does not show up while opening page from Mobile. Also Once script crashes internally, it removes the Page's Main Body content and replaces with Reader's code. So we cannot go back to previous state of the Page.