Categories
Browsers

Investigate JavaScript Execution Times Using Edge Dev Tools

This is a quick exploration of how to use Edge Dev Tools to investigate JavaScript execution time issues. We’ll quickly run a performance profile and identify what part of the JavaScript is the “most responsible” for any performance issues. The idea is to show just the quickest way to find the source of an issue, […]

Categories
Programming

Avoid Expensive innerHTML Manipulation with insertAdjacentHTML

It is pretty well known these days that fiddling with innerHTML is terribly inefficient. It triggers serialization, and it can result in invalid markup. Nevertheless, you’ll still find this being done in many applications. elem.innerHTML = elem.innerHTML + ‘<a href=”https://www.example.com”>Visit Example Dot Com</a>’; // or elem.innerHTML += ‘<a href=”https://www.example.com”>Visit Example Dot Com</a>’; You can avoid […]

Categories
Programming

Set a Minimum Font Size

This is just a little script I needed to use to increase text size conditionally. It only increases text below a minimum size and leaves everything else. (function () { var minFontSize = function () { $(“.content-zone *”).each(function () { var $this = $(this); if (parseInt($this.css(“fontSize”), 10) < 16) { $this.css({ “font-size”: “16px” }); } […]

Categories
Automation Programming

Manipulating Variables in JMeter

There are many reasons for manipulating variables in JMeter, especially when you are loading data from a CSV data set config element. You might want to trim a JMeter variable, or grab just a substring. In all of these cases, your existing knowledge of JavaScript can come to the rescue. Wherever you were about to […]

Categories
Analytics Programming

Debugging Adobe Analytics

Adobe Analytics can sometimes be a bit of an enigma, so people often turn to browser extensions to help them with debugging Adobe Analytics. However, for those of us who spend most of our lives in browser tools; there’s a simple way to get x-ray vision into what Analytics is thinking. Let’s get straight down […]

Categories
Programming

Fixing CSS object-fit for Internet Explorer

A common problem with images, especially if they are user-generated, is that they don’t have the correct aspect ratio for their intended purpose. Also, as we re-flow pages for many different devices, we often want the image to work with different aspect ratios. This is where the CSS object-fit property comes in very useful. There […]

Categories
Programming

HTML Loading Attribute for Lazy Loading Images and Iframes

If you have been writing websites or web apps for any length of time, you will almost certainly have implemented some form of lazy-loading using JavaScript. I recently worked on a web app that implemented a search that benefitted to the tune of half-a-gig by deferring the loading of images until those images were actually […]

Categories
Programming

Simplify Strings for Comparison by Removing Special Characters and Diacritic Marks

This is the JavaScript edition, but I also have a C# method to remove special characters diacritic marks. I was working on a search system that needed to simplify the strings for comparison. It needed to compare the text regardless of special characters (diacritic marks) or casing. The following function breaks the special characters into […]

Categories
Programming

Find All Images on a Page With JavaScript

One of the most common issues I see in content-managed websites is the presence of a fully-qualified image address that isn’t secure when the website itself is. When this happens, you’ll need to find all images that aren’t secure and fix them. For example, if you are visiting https://www.example.com and there is an image http://www.example.com/image.png […]

Categories
Programming

Minification Failed. Returning Unminified Contents.

Has you ASP.NET applicaiton reported that minification failed? If you are using bundles in application, you might come across this exception comment at the top of your larger-than-expected bundle file. /* Minification failed. Returning unminified contents. (List of problems here) */ It can happen for JavaScript or CSS, but it means minifier has found something […]