Back

David Walsh

Detect WebVR Support with JavaScript

2018-05-16 17:29:08

It’s been two years since I was heavily involved with WebVR at Mozilla but, despite not contributing every day, I can see VR making leaps and bounds, from Firefox making an increased effort to Chrome pushing VR and Oculus and HTC (Vive) improving their offerings.  Native games are getting better but, more importantly, browsers are getting faster and three.js and aframe are empowering incredible VR experiences with JavaScript.

Before you can serve up VR experiences, however, you need to ensure the browser supports VR experiences.  To do so, you need to ensure navigator.getVRDisplays is available:

const supportsVR = 'getVRDisplays' in navigator;

if (supportsVR) {
    navigator.getVRDisplays().then(function(displays) {
      // ... Load VR experience
    });
}
else {
    // ... Show "you need {x} browser" message
}

If navigator.getVRDisplays is present, it’s likely that the browser supports VR and AR experiences.

Virtual reality and augmented reality have the potential to change the world and enrich lives.  Learning how to code VR experiences will get you ahead of the curve, and as always, coding those experiences for the browser will break down the barrier of entry!

The post Detect WebVR Support with JavaScript appeared first on David Walsh Blog.

Read more

CDN, Web Security, and DDoS Protection from Incapsula (Sponsored)

2018-05-16 13:41:20

There used to be day that you could have a small to large website that didn’t require protection and worldwide CDN but, with how easy it is to initiate a DDoS attack and how important website speed is for search engine placement, it’s a given that you should look for a service to handle CDN and web security needs, regardless of the size of your site.  Over the past few months I’ve been experimenting with Incapsula, a service that provides DDoS protection, CDN, web app firewall, and load balancing, and I’ve been really happy with what I’ve experienced!

Quick Hits

  • Incapsula offers you a free trial
  • Incapsula provides CDN, security, DDoS protection, load balancing, and more
  • Incapsula is trusted by Wix, Thomson Reuters, Hitachi, and Siemens
  • Incapsula has added a focus on blockchain based security and availability
  • Incapsula’s WAF service is an all-in-one solution to protect your web assets

When you look at what Incapsula provides, you tend to get a bit excited!

Lightning Fast CDN & DNS

Speed is always the most pronounced, fancy feature of service like Incapsula, and for good reason:  speed makes your site load faster, ensuring you keep visitors happy, mobile visitors very happy, and the search engines placing your content high.

Incapsula gave me a huge speed boost with their CDN.  Their DNS boost is also nice!

Advanced Caching

CDNs are always nice but we know our assets better than an automated system so Incapsula lets you create custom rules, from simple to advanced:

I created custom rules for images in blog posts with draft status so that I could update them frequently without having to fight cache, as well as custom rules for theme assets as my theme can change at any time.  Images in demos and published posts are aggressively cached because it’s unlikely they change!

DDoS Protection

My website has been attacked in a variety of ways, from stealing my domain to hacking my database to straight DDoS attacks.  I wasn’t ready for any of those attacks but DDoS was the last of my worries; after all, I’m just a lowly web developer teaching web developer things!

DDoS attacks can be random or blatant regardless of the size of your site, and when your CDN and caching service provides it, your life as an admin is much easier.  The convenience is so important!

Total Web Security

Beyond basic DDoS protection Incapsula provides a web application firewall to protect from a variety of attacks.  This image shows the process as it relates to you, and you can customize each step of the way:

Using Incapsula has been a really enjoyable experience.  Setup was pretty easy and wealth of features is awesome — I never really felt like my test site was penetrable.  The user interface was elegant and I was never confused by what I was hoping to accomplish.  Not needing a separate CDN and security service is a major bonus!  Incapsula is really nice and my experience was better than I thought it would be!

The post CDN, Web Security, and DDoS Protection from Incapsula (Sponsored) appeared first on David Walsh Blog.

Read more