Knowledge base

Client-Side

What does “client-side” mean?

The term “client-side” means “in the user’s browser”, as opposed to “server-side,” which happens on your server before anything gets sent to the user’s device. You can add a <script> element to your page, and once it has loaded, you have access to all of the Netbiscuits Device Detection information, via JavaScript.

When the user’s browser encounters this JavaScript, it will download a file. The script will perform a series of tests to determine exactly which device the user is using. Once these tests have completed, you can use this information to make any changes you want, right in the user’s browser, based on the resulting parameter values.

Pros

The client-side option is great because you can make choices in the browser. For example, you could decide which video format or quality to display based on the user’s device type, browser, current bandwidth or even geo-location.

This option requires no change to your existing code, other than adding the <script> block to any pages on which you want to use Device Detection.

Cons

As great as client-side is, it does have drawbacks. One such drawback is that your users do have to download the JavaScript file and conduct the tests in their browser when your pages load. Depending on the parameters you have selected, the file will typically be less than 30kb.

And while on newer devices, this processing time isn’t really an issue, it could be a problem on older devices.

Additionally, download time and available bandwidth are both precious, especially in the mobile world where connection speed may vary. In order to take advantage of some the Device Detection parameter values, you will either need to send all of the various options to all devices, or make Ajax calls to fetch the correct option once Device Detection knows which device is being used.

Summary

None of the cons here are typically deal-breakers, but you need to know about them in order to make an educated decision.

The size of the JavaScript file can be partially mitigated by choosing a reduced set of parameters, thus reducing the size of the Device Detection script that your users need to download.

Dealing with the various code options is something you need to be aware of and properly plan for.

Maybe you only need a short set of parameters, or you only need Device Detection to make simple decisions in the browser, or maybe you don’t want to (or can’t) make a lot of changes to your existing code base. In any of these cases, client-side Device Detection could be just right for you!

Learn more about the JavaScript code

YouTube aktivieren?

Auf dieser Seite gibt es mind. ein YouTube Video. Cookies für diese Website wurden abgelehnt. Dadurch können keine YouTube Videos mehr angezeigt werden, weil YouTube ohne Cookies und Tracking Mechanismen nicht funktioniert. Willst du YouTube dennoch freischalten?