What's the window size of a background tab?

by @edent | , , , , , | 1 comment | Read ~538 times.

The Outer window size is zero by zero.

Whenever I open Twitter in a new tab on my phone, the page layout looks weird for a few seconds. It starts out looking like the desktop view and then, after a few seconds, it snaps back to the mobile view. What's causing this? Try opening this link to a window size detector in a…

Just because I have a vertical screen, doesn't mean I'm on a phone!

by @edent | , | 9 comments | Read ~30,756 times.

The Just Eat website.

I'm a weirdo - I fully admit that. As part of my home working set up, I use a vertical monitor. I read and write a lot of long documents - and this form factor suits me perfectly. I've been doing this for a long time. It is a natural part of my workflow. For…

Please stop using CDNs for external Javascript libraries

by @edent | , | 35 comments | Read ~42,766 times.

The HTML5 Logo.

I want to discuss a (minor) antipattern that I think is (slightly) harmful. Lots of websites use large Javascript libraries. They often include them by using a 3rd party Content Delivery Network like so: <script src="https://cdn.example.com/js/library-v1.2.3.js"></script> There are, supposedly, a couple of advantages to doing things this way. Users may already have the JS library…

Major sites running unauthenticated JavaScript on their payment pages

by @edent | , , , , , | 11 comments | Read ~30,718 times.

HTML code from Spotify.

A few months ago, British Airways' customers had their credit card details stolen. How was this possible? The best guess goes something like this: BA had 3rd party JS on its payment page <script src="https://example.com/whatever.js"></script> The 3rd party's site was hacked, and the JS was changed. BA's customers ran the script, which then harvested their…

Redirect GitHub ID to Username

by @edent | , , , , | Read ~2,011 times.

A screen of JSON code showing my details.

Scratching my own itch here... GitHub users have a username (mine is @edent) and have a user ID number (mine is #837136). If you want to redirect a user ID to a username, you can use the little service I've cobbled together: https://edent.github.io/github_id/#837136 That will take your browser to my GitHub page, using nothing but…

This SVG always shows today's date

by @edent | , , | 18 comments | Read ~49,249 times.

A graphic of a calendar showing the date "February 25 Sunday"

For my contact page, I wanted a generic calendar icon to let people view my diary. Calendar icons are almost always a skeuomorph of a paper calendar, but I wondered if I could make it slightly more useful by creating a dynamic icon. Here it is, an SVG calendar which always display's today's date: The…

Using canvas to shrink images for Google Cloud Vision

by @edent | , , | Read ~116 times.

The HTML5 Logo.

I've started using Google Cloud Vision for running text detection on OpenBenches images. There's just one problem - Google limits the size of the files that it will accept to 4MB. Why? Who knows! Obviously, it's easy to shrink an image server-side, but how do we do it in the browser? First, let's take a…

No Javascript Day

by @edent | , , | 3 comments | Read ~2,118 times.

I'd like to propose that web designers around the world spend one day this year browsing the web with JavaScript disabled. I'm tentatively calling this "International No Javascript UseR Experience Day" or INJURED for short. A few weeks ago, a reader of my blog complained that all they saw was a blank screen. As Liz…

Aggressively Defensive Programming

by @edent | , , , | 3 comments | Read ~557 times.

How much checking do we perform that our code is running as intended? I found a curious bug this weekend, which made me think about some of the assumptions that we use when programming. Imagine sorting an array using JavaScript. var arr = [10, 5, 66, 8, 1, 3]; arr.sort(); So far, so normal. Create…

Visualising Conversation Threads In Hyperbolic Space

by @edent | , , , | Read ~663 times.

In 2009, Kosso and I petitioned Twitter to allow us to search for Tweets by their "in reply to" ID. The idea was that developers could created a properly threaded view of conversations. Of course, Twitter being ultra-responsive to developers, did absolutely nothing. Skip three years into the future, and App.net is providing all the…