Offline Mode - Custom Config Load Issue

40 views
Skip to first unread message

David Collins

unread,
Jul 28, 2015, 12:15:58 PM7/28/15
to PDFTron WebViewer
I am implementing an offline solution, similar to the offline library sample and am running into problems getting configurations to load when offline.  I use series of custom configs, and I set the config option when i instantiate the viewer.  All of it works fine when online.  I include the config files in the offline manifest, but the custom config are loaded dynamically with ajax and it will not load the custom config, even though the files are there.  To get it to work, I found that I had to steal some code from ControlUtils.initializeReaderControl to force the ajax call to load the config files from the application cache:

function loadConfigScript() {
            if (configScript !== null && configScript.length > 0) {
                if (queryParams.getBoolean('startOffline')) {
                    $.ajaxSetup({
                        cache: true
                    });
                }
.....

I'm not sure if there is a better way to do this, or if this is an appropriate fix.  Any feedback would be appreciated.

Thanks,
David Collins


Anatoly Kudrevatukh

unread,
Jul 31, 2015, 7:36:22 PM7/31/15
to PDFTron WebViewer
Hello David,

This is an appropriate fix.

Let me know if you have additional questions.
Reply all
Reply to author
Forward
0 new messages