Paul "Pablo" Croubalian

6 years ago · 6 min. reading time · ~100 ·

Blogging
>
Paul blog
>
What Happened to Your Browser When You Weren't Looking

What Happened to Your Browser When You Weren't Looking

4 Re :You know browsers. They're those thingies that let you surf the net. There's nuthin' to them. Right? I mean. . . you type in a link or even just click on one, and whammo. . . there it is!

"There's nuthin' to 'em," you may think.

You'd be wrong. 

You were right in the Dark Ages of 1999, but not anymore. The browser you use to read this article is a sophisticated piece of software that automatically and seamlessly interacts with several hundred APIs (Application Programming Interfaces) to get the best possible version of this article onto your screen in the shortest possible time.

That means browsers have access to data and information about your screen. They also know, obviously, the link you want them to display. They run through decision trees to optimize the physical side of your experience.

Some people are saying that also means they can decide what to show you. Nope. That's just an example of, "A little knowledge is a dangerous thing."

Malicious code does exist, but it is not incorporated into browsers. Further, browsers and their related APIs are standards-based. The two primary browsers, Chrome and Firefox follow these standards. Use John Doe's Freeee Souper-Douper Browser and all bets are off. I made that browser up. My apologies to John Doe if it actually exists.

Google spearheads browser development. They're a web company, some may argue that Google is the web. Be that as it may, there is no doubt that Google Chrome is the dominant browser by miles. 

It is in Google's best interests that all traffic flows through a browser, preferably Chrome. Most of it does. Then again, there are those pesky apps that spit out traffic directly.

The Responsive Web and the Progressive Web are Google's answer to mobile apps. A fully responsive, fully progressive website functions so much like a native app that users can't tell the difference. 

Companies can and do tell the difference. 

A single Progressive Web app works seamlessly on anything from an AppleWatch to an 8G Smart TV. No more multiple versions for multiple operating systems. No more updates. No more supporting multiple versions.

One size fits all, and development time is cut dramatically. That means big cost savings. Companies like big cost savings.

The Progressive Web even does stuff with no connectivity. I'm not kidding. If you develop mobile apps for a living, get certified on the Progressive Web. Do it now. Don't wait for Google to kick your teeth in. In a dogfight against Google, you will lose.

The simple stuff: New HTML tags

I talked about this in https://www.bebee.com/producer/@paul-croubalian/is-the-responsive-web-a-mobile-app-killer-pt-1 so I'll just feather-touch it here.

Browsers can't tell how big a file is until they actually download it. By then it's too late to save any time. The obvious solution is to tell the browser which files are available, of which size and let it choose. The new HTML tag, srcset, does just that.

Src (source) is an HTML image tag. Srcset is a set of srcs. It's a lot faster to download a 150K image intended for a phone than a 33Mb image intended for a smart TV. 

Srcset gives the browser the choice of several versions of an image, or even completely different images. It tells the browser how big each file is. The browser is "smart" enough to pick the one that is closest to your device's needs. That is to say, not very smart at all. It just knows to download the image whose size is closest to your device's screen size.

That means pages load as fast as possible for your particular device. That's a good thing.

The not so simple stuff

Everything the browser does in the background is done through some flavor of Javascript. Javascript is a programming language that acts only on the client side, i.e. in the browser. It can also use AJAX methods to access/write to remote databases.

Javascript does not have carte blanche, neither does AJAX. Javascript's limitations make it perfect for secure action. A description of AJAX methods is far beyond the scope of this simple primer. Suffice it to say that AJAX also has built-in limitations, and is not a scouring powder.

Service Workers

You all have workers that work all day, every day. They interact with every customer, every time those customers visit your website. They're never late to work because they never leave. They take no vacations because they don't get tired. They take no sick days because they never get sick. 

They may die on the job, but no one would care if they did. 

IT or Marketing would just replace them. Yes, IT or Marketing would replace them, not Human Resources. These workers aren't H at all so HR doesn't care.

These workers are Service Workers. Service Workers are javascript scripts (yes, I know that sounds funny) that sit between the client (browser) and the web (remote servers). 

VI

 

Blog Poets

About the Author

I'm a ghost but not the kind that's to pottery
wheels. I'm the wnting kind

Toften wonder if Im a tech-savvy writer or a
writing-savvy technologist Maybe I'm both. As
one CMO put it, "Paul makes tech my bitch!
That might be going a hittle too far

myTweetPack.com
The Ultimate Twitter SystemAny browser request runs through the Service Worker. That's the little guy icon. I think of Service Workers as traffic cops.

The Service Worker checks the browser cache first. If it finds what you asked for, great! It takes it from the cache. Reading from the local cache is way faster than reading from a remote server. 

If whatever you asked for isn't in the cache the Service Worker then looks to the web.

When the web server responds, the Service Worker sends that response along to the browser. A well-written Service Worker will also check for no connectivity or low connectivity (Timeout or what Google calls "lie-fi." That's when your device says it has a connection but doesn't. That's a worse experience than no connectivity at all. You don't even get an error, just a blank screen). When it detects no/low connectivity it can respond from previously stored stuff in the cache.

It's what Google calls "Off-Line First" web app development.

As far as the browser knows, it got what it asked for. It doesn't particularly care where it came from, but you do. Why wait 5 - 15 seconds for a server round trip when you can get the same thing with no discernable lag?

Another use for Service Workers

That red arrow from the server can also start something. For example, a web push notification goes from server to Service Worker. If the notification is to a valid, authorized endpoint (basically just a link that identifies a browser that allowed notifications in the first place), it shows it. It doesn't matter if the sending website is open or not. The Service Worker that controls it is in the browser. 

This type of Service Worker acts more like a listener, waiting for a server to wake it up. That makes them open to misuse. That's why they require express permission from the browser's owner to actually exist. Also, every notification has a "kill switch" built right into it.

Wow, isn't all that stuff dangerous?

Not at all. Well, no more than surfing the web in general anyway. There has been talk that since the Service Worker actually "decides" what you see, it can decide what you "should" see. You would only see what it wants you to see, what it allows you to see.

Nope. It just doesn't work that way. That's more "The Sky is Falling!" than reality. There are safeguards built right in.

The First Line of Defense

The first line of defense is Javascript/AJAX itself. They have limitations on what they can do. Those limitations are intentional. They provide a cushion against unwanted or malicious actions.

The Second Line of Defense

The second line of defense is "scope." That takes some explanation. 

If you are a consultant or a project manager, you are familiar with  Scope of Work documents. Those documents specify what you will do, where you will do it, and when you will do it. Service Workers have their own built-in Scope of Works called, logically enough, "scope."

A (very) brief explanation of Scope

Service Workers can only work in the directory where they are saved or any lower (child) directory. You can override that when the Service Worker is first installed on the browser, but only in the same domain. So, if the Service Worker is in https://www.myTweetPack.com/javascript/serviceWorker.js (not a real link) It will only wake up on any hyperlink that starts with https://www.myTweetPack.com/javascript/. Navigate away and it goes back to sleep.

I can specify that the Service Worker will work on anything that starts with https://www.myTweetPack.com if I want, but nothing else. I can't even specify that it should work on http://www.PaulTheGhost.com, even though that site sits on the same server. PaulTheGhost is a different domain, so the Service Worker will fail to install.

That means I can't have a Service Worker that works on everything, everywhere. The exception to that rule is the web push Service Worker I mentioned. It will work anywhere but it only works on inbound traffic with express user permission that can be easily withdrawn at any time

I don't own www.Google.com (no such luck) so I can't install Service Workers there. I can't hijack your requests. No one can.

You may now say, "Yes, but Google does own www.Google.com. They can put whatever they want there!" Okay, that might be an issue if it weren't for the third line of defense.

The Third Line of Defense

The third line of defense is transparency. Service Workers are just Javascript code. They are just text files. The code is visible. 

Anyone with Google developer credentials (free at Google.com) can see which Service Workers are installed in a browser, whether they are actively working or not, and what they do. 

Don't break your head over that. If Google or Firefox tried to play games with their Service Workers they would be outed by the developer community within minutes if not seconds. Nobody wants Big Brother.

The Fourth Line of Defense

The fourth line of defense is another limitation. There's another reason why I can't specify that my Service Worker will work on http://www.PaulTheGhost.com. Only https websites can use Service Workers. 

The process for getting https credentials is more detailed than for a simple http site. It includes verifying ownership before a certificate is granted. That means that those who somehow manage to circumvent Service Workers safeguards can be easily traced and stopped. 

Not all browsers support Service Workers (Yet)

As of December 4th, 2017, only Chrome and Firefox give full support for Service Workers. Mabe "only" shouldn't be used here. Together, Chrome and Firefox cover about 74% of internet users. I was actually surprised that Google Chrome was "only" 58% of the market.

Support is in development for Microsoft Edge. Internet Explorer is on its way out. Microsoft has no plans for IE service worker support. That's strange because IE is actually the third most popular browser with nearly as many users as Firefox. 

Go figure.

Opera and Safari will only offer basic support for Service Workers which may well ring their death knell. True, some people love their Opera and Safari browsers. The two browsers only account for less than 5% of users combined. 

If Chrome and Firefox combine for 74% and Opera plus Safari combine for 5%, what makes up the other 21%? That 21% is mostly antiquated browsers (Ex: Internet Explorer 13.13%) and a few specialty browsers here and there. 

Service Workers make too much sense to ignore. 

My not-so-fearless prediction is that browsers that do not have full support for Service Workers will see their market share dwindle. Eventually, they will face extinction.

Cheers

If this article resonated with you, please share it to Twitter. A share to Twitter triggers a vote for the beBee's Best eZine. 
Thank you

032f0075.png








"""
Comments

Lyon Brave

6 years ago #16

my browser cheats on me with other people

Paul "Pablo" Croubalian

6 years ago #15

#20
Or, you can simply disable Javascript or surf in incognito mode. . . neither is recommended. The thing is that service workers and the Progressive Web are not bad things, they are beneficial things. The likelihood of misuse is minuscule. There are far easier ways to act maliciously. Cut Javascript and the first thing you'll notice is that your surfing will be slow like pouring molasses in winter. Then, there will be losses in functionalities. You won't get push notifications that you signed up for. You will fly back to pre-browser-cache days. There's a really good reason why those days are best left behind us. Location tracking (GPS) doesn't happen at the browser level. It can, but only with your express permission.

Paul "Pablo" Croubalian

6 years ago #14

#18
No worries, Don Philpott\u2618\ufe0f. These comment threads tend to take on a life of their own. It's one of the best things about beBee

Phil Friedman

6 years ago #13

#13
Paul \, you and I have a different perspective on this issue -- perhaps irresolvable. You use phrases like "... It is in [their] best interest ..." and " I can always count on people and companies to do what is in their own best interests ...". None of which establish the impossibility of manipulating what is presented and consequently seen. Moreover, I submit that it is not what is in a person or company's best interest that guides their actions, but what they *perceive* to be in their best interests -- which is often not the same thing. Google, for example, already cynically manipulates user perceptions when those users are performing searches by slipping into the search entries returned, at the top and the bottom of the page, several entries that at actually paid advertising spots. Now, you will say that is overt and well known. But I have talked to literally dozens of people who never recognized those entries as ads, so subtle is the method for setting them off from the legitimate list of returns on the search. And you can't really believe that the confusing treatment by Google is inadvertent. Which is why I remain skeptical about trusting anyone who is in a position to control what is seen and communicated on the web. Cheers!

Paul "Pablo" Croubalian

6 years ago #12

#11
LMFAO Randy. Hmm, food for thought re: getting myTweetPack on fax machines. I could go to a museum to test it. Actually, you aren't far removed from reality. myTweetPack is now looking at voice/SMS/Text-to-Speech integration and world-wide messaging. It's sort of like a fax machine, except not at all like a fax machine LOL

Paul "Pablo" Croubalian

6 years ago #11

#12
Yes and no, Phil Friedman. No - This standards-based method makes it well-neigh impossible to do that without immediate and serious repercussions. The Facebook example doesn't stand up. Facebook is an application on its own, with proprietary code and methods. It shows up in a browser but has nothing to do with the browser. Facebook is indeed notorious for opening doors for users to build audiences, then slamming them shut behind a paywall. That's just Facebook doing what's best for Facebook. That's normal. I can always count on people and companies to do what is in their own best interests. I am rarely disappointed. Web surfing IS NOT Google's business. Selling data and advertising IS. It is in Google's best interest to keep the web free, open, and most importantly, busy (preferably on Chrome). Look at it this way, Chrome users are not Google's Sales Department but their Manufacturing Department. . . they "manufacture" data and ad markets by using the web. Without users, ad revenues and data sales revenues would disappear. Until that model changes, it is in Google's best interest to support and police the Progressive Web. I expect they will. Yes - Who knows what the future will bring? Will Google decide on another model and force changes? Will someone come up with that "better mousetrap" and steal Google's lunch? One thing for certain, while this set of technologies is a great step in the right direction, it isn't the last step of the journey. Something always takes over eventually. For all we know, Amazon, which is really just an e-commerce search engine, is planning to fight head-to-head with Chrome. Amazon and Google are already at war, so it is conceivable, albeit unlikely.

Phil Friedman

6 years ago #10

Paul \, this is a very informative and useful article. Thanks. However, Buddy, I'd be remiss not to call you out on one statement, you make. You say, "Malicious code does exist, but it is not incorporated into browsers." Nobody, certainly not I, ever said such code was, in fact, already incorporated into some or any browsers. I cannot speak for anyone else, including Don Philpott\u2618\ufe0f, but I personally said recently I believe WE (in the general sense of the term) need to be vigilant to guard against it happening in future. Because it is a short step from managing how best to display what we've asked to see to deciding what we want to see most (filtering with good intent) and then an even shorter step to deciding what we ought to see (manipulating our worldview). Even assuming that you have access to solid information that browser manipulation of what we see is not taking place now, it still does not follow that it could not in future. Who thought years ago that Facebook would have embarked on a program of just such manipulative filtering? Cheers!

Randall Burns

6 years ago #9

#9
I do the same thing with my dial landline phone and my fax machine Franci\ud83d\udc1dEugenia Hoffman, beBee Brand Ambassador Hey did you guys hear about the new mega-merger about to happen? Apparently You-tube, Twitter and Facebook are going to merge. Very exciting stuff! It's going to be called; "You Twit Face"

Paul "Pablo" Croubalian

6 years ago #8

#9
That's a great example of how people use browsers, Franci. If you signed up for System Notifications from myTweetPack, you'll see that they work on both browsers, but look different.

Paul "Pablo" Croubalian

6 years ago #7

#7
Thank you, Ali

Ali Anani

6 years ago #6

Paul \- very rich and ideas-filled buzz. It is of relevance to who are using the web. Shared

Paul "Pablo" Croubalian

6 years ago #5

#4
Thank you, Dilma. The nicest thing about this stuff is that you don't really need to keep an eye on it. It just works and works well.

Paul "Pablo" Croubalian

6 years ago #4

#3
"Burns, Randall Burns" Has a nice ring to it. I'd avoid, "Burns, Randy Burns." Someone might misinterpret that.

Randall Burns

6 years ago #3

#2
LMAO!!!! I like it! Sounds like the theme for my next "Date night" with the wife, guess I better rent a tux and an Aston Martin... :-)

Paul "Pablo" Croubalian

6 years ago #2

#1
LOL, you sound like my wife with her flip phone. Here's a suggestion. I noticed that two international assassins in movies used the same flip phone model as an untraceable burner. You're not antiquated. You're an International Man of Mystery. Come to think of it, a Chef would make a good cover. Hmmm. . . .

Randall Burns

6 years ago #1

Interesting read Paul \ I guess the "writings on the wall" regarding my"Internet Explorer" as I still use that but am forced more and more lately to use "Google Chrome" to open files/attachments/videos etc. My computer is constantly asking me, "Do you want to upgrade your browser to Google Chrome now?" but I am stubborn and don't like change, pisses me off every time Windows has an update. I'm sure this will all make more sense to me if and when I ever get a "Smart Phone' or other mobile device but I'm just now getting used to my "Flip phone" and I can finally text on it like nobody's business. Really dreading the day when I'll have to admit that it's time to hand it over to "The Smithsonian" and get something a little more contemporary, (like from this century). I'm reminded of a quote by Charlton Heston about Guns and the 2nd amendment but I will alter it slightly, "I'll give you my Flip phone when you can pry it from my cold, dead hands" Informative post and I'm thankful for guys like you Pablo keeping me in "the loop" with all this "tech stuff", I've got enough other things keeping me busy. :-)

Articles from Paul "Pablo" Croubalian

View blog
5 years ago · 4 min. reading time

I think my re-entry · into the dating world would make a good sitcom. Or maybe it would make a bette ...

5 years ago · 6 min. reading time

Many of you · are curious about what happened · between · Coco and I. I'm somewhat surprised, frankl ...

5 years ago · 9 min. reading time

Last Saturday was the day of "The Talk." You know, that's the talk that results from those words tha ...

Related professionals

You may be interested in these jobs

  • PURE Canadian Gaming

    Food and Beverage Supervisor

    Found in: Talent CA C2 - 6 days ago


    PURE Canadian Gaming Calgary, Canada Full time Hourly

    Title · Food & Beverage Supervisor · Reports To · Food & Beverage Manager · Summary · The Food & Beverage Supervisor assists the Food and Beverage Manager in managing the department to ensure superior guest satisfaction. This individual will assist in overseeing the overall ...

  • Kiewit

    Electrical Estimator

    Found in: Talent CA C2 - 6 days ago


    Kiewit Montreal, Canada Full time

    Position Overview · As an Electrical and Instrumentation Estimator, you will be responsible for analyzing submission documents and preparing quantity and cost evaluations for a project for the electrical component. You will also be involved in the development of the execution pl ...

  • Groupe Touchette Inc

    Warehouse Manager

    Found in: Talent CA C2 - 2 days ago


    Groupe Touchette Inc Montreal, Canada Permanent

    The Warehouse Manager assumes leadership of the team by being an ambassador for good practices. His/Her sound business sense allows him/her to make informed decisions regarding the use and optimization of material and budgetary resources of the distribution center in order to ac ...