Pdfjs and other CDN content

Greetings!

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

Comments

  • edited May 2016

    Hello,

    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
    http://webix.com/packages/webix.cdn.zip
    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!
    Martin

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

    https://github.com/webix-hub/cdn-extras

  • 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:
    webix.codebase="";
    webix.cdn="/static/webix"

    but it breaks webix.UploadDriver
    swfobject.embedSWF(webix.codebase+"/legacy/uploader.swf"

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

  • @keson try this solution

        <script>
                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";
        </script>
    
  • @integral it works well, thank you

Sign In or Register to comment.