Pdfjs and other CDN content


I'd very much prefer not to have dependencies on external websites for our product deployments. For example: pdfjs is pulled from 'http://cdn.webix.com/extras/pdfjs' (I realize there are others).

In some cases, we have users who will not have access to the Internet, only the application's server (and other servers on their network).

Any suggestions?

Best Regards


  • edited May 2016


    You can get the needed CDN-files from https://github.com/webix-hub/cdn-extras

    And then set the path as

    webix.cdn = "/local/cdn";
  • Thanks very much!

  • Will the zip file above work with any recent version of Webix, or are there different cdn zips for the different Webix versions? Will the above work with 3.2 or 3.3?

  • All CDN content should work with the latest Webix version as well.

  • Hi,

    using the local cdn with the provided files in
    webix can't find several files which are missing in the zip and the folder structure is not right.
    Could you check that again?

    Thank you!

  • @martinfruehmorgen right you are. We've copied all CDN content to the GitHub repository:


  • Thanks for the cdn-extras link. That resolved my issue.

  • Hello,

    i tried to set local cdn for exporting data to excel/pdf and it seems, that it requires to set both webix.codebase and webix.cdn helpers:

    there is function, that extract codebase folder from SCRIPT tag:
    for "/static/webix/webix_debug.js"
    webix.codebase = "/static/webix/"

    in webix.toExcel we have:
    webix.require(webix.cdn + "/extras/xlsx.core.styles.min.js", function(){

    in webix.require function there is fullpath var:

    var fullpath = module;
    if (!module.toString().match(/^([a-z]+:)*\/\//i))
    fullpath = webix.codebase + module;

    and this fullpath is used to obtain module f.i.: /extras/xlsx.core.styles.min.js with pattern: webix.codebase + webix.cdn + module,

    so for webix.cdn =="" it gives "http://localhost/static/webix//extras/xlsx.core.styles.min.js"

    in webix.toPDF webix.require loads script with same pattern:
    webix.require(webix.cdn + "/extras/pdfjs.js", function(){
    and then uses fullpath as above

    but ttf font if loaded without adding webix.codebase to path:
    pdfjs.load(webix.cdn + "/extras/"+options.fontName+".ttf", function(err, buf){ and it gives error if webix.cdn is not set.

    so for now webix.codebase and webix.cdn could be set as follows:

    but it breaks webix.UploadDriver

    To sum up: for local cdn.extras something is broken

  • @keson try this solution

                if (!window.location.origin) {
                    window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
                } // old browsers compatibility
                webix.cdn = window.location.origin + "/cdn";
  • @integral it works well, thank you

  • Hello!

    Just for the record, it seems that now cdn location is updated with enviroment variable like this webix.env.cdn = "/cdn" also contents of the github repo https://github.com/webix-hub/cdn-extras have to be placed in the extras folder, so it would work with webix.env.cdn = "/cdn"

  • Hi @AlexPetrov

    You're right, in version 6.0 global properties that describe/define the current environment were moved to webix.env(API).

    If you are moving from an older Webix version, please make sure to check the migration guide for the full list of updates, including breaking changes in major releases.

Sign In or Register to comment.