Home : WingScan : Adding jQuery browser back to jQuery 1.9+ for the WebDocumentViewer
Q10383 - HOWTO: Adding jQuery browser back to jQuery 1.9+ for the WebDocumentViewer

If you upgrade the jQuery version you are using with the WebDocumentViewer/WebDocumentThumbnailer to a version of 1.9 or newer you may see an error in your browser console similar to "Unable to get value of the property 'version': object is null or undefined". This is because the WebDocumentViewer internally calls jQuery's .browser, which was removed in 1.9 and newer.

We are aware of this, and until all the internal calls are removed you will need to make sure that jQuery's browser is present regardless of the specific version of jQuery you are using. There are a few simple options for this.

First, jQuery provides a migrate plugin that adds all removed functionality back. You can acquire it from http://jquery.com/download/. There are several CDNs that provide it as well if you do not want to include it in your project resources directly.

NOTE: You may need to add the 'scripturl': '/pathOfWebDocViewerResources/' property to your viewer configuration if you choose to use the non-minified version of Jquery. We recommend using the minified versions of the Jquery scripts to avoid this... but here's the usage:

var _viewer = new Atalasoft.Controls.WebDocumentViewer({
         'parent': $('#_container1'), // parent container to put the viewer in
         'serverurl': _serverUrl, // server handler url to send image requests to
         'documenturl': _docUrl,  // document url relative to the server handler url
         'scripturl': '/pathOfWebDocViewerResources/',
         'allowannotations': true,
});

The 'scripturl' path must match and does require the trailing / - if you get the wrong scripturl value, annotations will simply fail to work (silently) . (this can be especially difficult to pin down when using ~/ paths in MVC - to resolve those, you'll need to use the @url.Content() method like this:

'scripturl': '@Url.Content("~/Scripts/WebDocViewer/")',

 

Secondly, this StackOverflow post has a more lightweight solution of adding only the .browser call back in to your jQuery instance: http://stackoverflow.com/a/14431233/2355622

Both of these methods will work.

 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved