Partying with Third-Party Content

Anantha Krishnan
12/6/16

Third-Party JavaScript Interception

JavaScript Interception

Web applications are increasingly built with many third party JavaScript libraries. Despite using a content delivery network (CDN), a web application can experience slowness if it uses third-party JavaScripts that download slowly. In other words, the benefit of using a CDN is not automatically extended to the third-party JavaScript content used by the web application.

Instart Logic's AppSpeed performance suite offers JavaScript Interception that really shines here. It extends the benefits of a CDN to third-party JavaScript in web applications by transforming these elements in HTML in a way that makes the browser send the requests for third-party JavaScript to Instart Logic’s Network instead of the third party's origin.

JavaScript Interception

In many cases, this leads to remarkable improvements in page render and load times due to savings around DNS lookup, SSL connection setup, and of course the use of Instart Logic’s superior application delivery service. Learn more about how client-side JavaScript Interception works.

Identifying Suitable Scripts

Not all third-party JavaScripts are suitable to be cached. This may be due to HTTP cache control directives from the third-party origin or the presence of cookies.

When a third-party origin indicates a script should not be cached via the HTTP Cache-Control header as in the example below, we need to honor it and hence cannot apply JavaScript Interception on it.

Cache-Control: private

Another example is a third-party response that sets a cookie for tracking purposes, as shown below. This indicates that the third-party origin expects subsequent requests for it to carry this cookie. Here, if the domain of the request is changed to customer.com, the browser cannot set the cookie in the third-party domain as expected by the third-party origin. Hence we need to avoid applying JavaScript interception here too.

Set-Cookie: abc=123; Domain=thirdparty.com

It is necessary to identify the right set of JavaScript resources which can be intercepted and cached from a customer's web application. As you rightly guess, manually identifying these scripts is impractical considering the fact that web applications change frequently and may have hundreds of pages.

Smart Learning

So, what does a customer do to identify which third-party scripts can be served via Instart Logic's JavaScript Interception feature? The answer is  "nothing!". JavaScript Interception intelligently learns about customers' web pages and serves only the right set of third-party scripts via Instart Logic’s network.

We call this Smart Learning. This process uses advanced machine learning to build a set of JavaScript URL patterns that are good candidates for applying JavaScript Interception, while scripts with cookie or cacheability issues are automatically blacklisted. Instart Logic’s Nanovisor technology makes this happen fairly quickly by learning from scripts present in page requests from real users, after which the feature gets applied to subsequent page requests. The learning continues even while the feature is in action on customer’s pages. This is important to ensure best performance and maintain functional correctness of pages, despite changing pages and scripts.

Smart Learning

Leveraging Nanovisor Technology

This magic is possible only because of Instart Logic's disruptive Nanovisor technology that has deep insights into the way the browser handles JavaScript and other content. Nanovisor is a thin JavaScript virtualization layer that leverages the power of modern browsers. It is the brain behind many of Instart Logic's endpoint-aware application delivery features.

The future is exciting, as we release more innovative features that leverage the Nanovisor technology in the Instart Logic platform.

Learn more about Instart Logic:

Leave a Reply

Your email address will not be published. Required fields are marked *