Offline mode in WebView Container (Android and IOS)

1,452 views
Skip to first unread message

kava

unread,
May 4, 2015, 1:36:03 PM5/4/15
to pdfnet-w...@googlegroups.com
Hi Mat,

We have developed mobile web app (PDF viewer) .
We have enabled offline mode.

When our client embedded the URL in IOS UIWebview container , they couldn't load the web app,

Offline is not working , is there any limitation or special settings needs to be enabled to have it working

note: every thing works fine outside webview container 

appreciate if you could guide me on this


Regards,

Kava

Matt Parizeau

unread,
May 4, 2015, 3:51:02 PM5/4/15
to pdfnet-w...@googlegroups.com
Hi Kava,

Which version of WebViewer are you using?

There was an issue with iOS8 in a UIWebView that we added a workaround for in the recently released WebViewer version. The fix is included in version 1.8.2 or 2.0, so I would try using one of those versions and see if the problem persists.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

kava

unread,
May 5, 2015, 12:32:17 PM5/5/15
to pdfnet-w...@googlegroups.com

Hi Matt,

thanks for the prompt reply,

yeh iOS7 is working fine , we are only having issue with iOS8, I will try new version of webviewer as suggested,

What are the files needs to be updated (mobileReaderControl.js or any other files)


Regards,

Kava

kava

unread,
May 11, 2015, 1:04:24 PM5/11/15
to pdfnet-w...@googlegroups.com
Hi Mat,

I had to ugrade to webviewer 2.0 code base in order to fix  iOS 8  offline storage issue as suggested by you.
I managed to get it working (offline portion),

document loads fine (its storing indexdb in initial loading-chrome) and loads document.

could you help to review the code and suggest if any best practices.

Note: I'm using MobileReaderControl.js - i didn't make any changes to it at all.


Regards,

Kava
index-offline-implementation.html

Matt Parizeau

unread,
May 11, 2015, 1:27:58 PM5/11/15
to pdfnet-w...@googlegroups.com
Hi Kava,

From a glance I think the code looks reasonable. One thing to be careful is that I believe the loadDocument function looks at a query parameter to read the startOffline value so if you're creating WebViewer with new PDFTron.WebViewer then you should set the startOffline option to true and then you wouldn't have to set readerControl.startOffline manually in the config file. Alternatively remove the setting of startOffline in the loadDocument function.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

kava

unread,
May 14, 2015, 12:42:24 PM5/14/15
to pdfnet-w...@googlegroups.com
Hi Matt,

I'm facing small issue loading "images/ajax-loader.gif" jquery mobile css,

it is happening since I upgraded to webviewer 2.0 (it was working fine with 1.8.1)

instead of showing ajax loader image when I swipe it shows blank page for a while and renders the page.

ajax-loader.gif file exists in external/jquery.mobile/images folder

it is a small but very important issue for the current project



Regards,

Kava

kava

unread,
May 14, 2015, 12:42:24 PM5/14/15
to pdfnet-w...@googlegroups.com
Hi Matt,

Thanks Matt,

Noted

Regards,

Kava

Matt Parizeau

unread,
May 14, 2015, 1:01:07 PM5/14/15
to pdfnet-w...@googlegroups.com
Hi Kava,

Are you able to reproduce the issue in a default uncustomized WebViewer? By default WebViewer doesn't use ajax-loader.gif, it uses external/images/loading.gif for page loading. Also in WebViewer 2.0 the file MobileReaderControl.css was added and inside of there it uses the loading image, but as a data URL embedded in the css. Make sure you update all of the files when using WebViewer 2.0 as a number of things have changed since 1.8.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

kava

unread,
Jul 15, 2015, 4:56:41 PM7/15/15
to pdfnet-w...@googlegroups.com
Hi Matt,

I have been using MobileReaderControl.js of WebViewer 2.0

I'm trying to implement custom tagging code, It must be fired once when user swipe or move the slider button

I tried to put the tagging code below me.docViewer.on('pageNumberUpdated' function, but facing this issue

1. putting tagging inside onSwipe() function works fine (tagging fires once)- OK
2. when I move slider , it fires twice - NOT OK, 

I want to invoke tagging code whenever user navigates to pages. (regardless of which event he uses - swipe or slider dragging)


Pleas help

Regards,

Kava

Matt Bojey

unread,
Jul 15, 2015, 7:20:35 PM7/15/15
to pdfnet-w...@googlegroups.com
Hi Kava,

I am not sure that I understand where you are putting your code.  Does your custom code look something like this: 

$(document).on('documentLoaded', function() {
    readerControl.docViewer.on('pageNumberUpdated', function(){
         alert('foobar');
    })
});

With this code the 'pageNumberUpdated' event is only fired once regardless of how the page number is changed and there is no need to put your code in the onSwipe function as well.  Let me know if this is not what you are looking for.
Reply all
Reply to author
Forward
0 new messages