Course contentsShow
← Web Development
Lesson 1706 of 2,98231. Error Handling and ResilienceFree lesson

Testing Offline Scenarios

Using DevTools network throttling and offline simulation to test connectivity handling.

Testing Offline Scenarios

What you'll learn: How to use browser DevTools to simulate poor or missing network conditions and verify your offline handling works correctly.

Why Simulate Offline Conditions?

You've built offline detection, reconnection strategies, and graceful degradation patterns—but how do you know they actually work? Manually unplugging your network cable or disabling WiFi is clumsy and doesn't simulate real-world conditions like slow 3G or intermittent connectivity. DevTools provides precise control over network simulation for thorough testing.

Using Network Throttling and Offline Mode

Modern browsers (Chrome, Edge, Firefox) include DevTools network panels with built-in throttling profiles:

Chrome DevTools:

  1. Open DevTools (F12)
  2. Navigate to the Network tab
  3. Find the Throttling dropdown (usually says "No throttling")
  4. Select "Offline" to completely block network requests
  5. Choose presets like "Slow 3G" or "Fast 3G" to test degraded connections

What happens when you enable Offline mode:

  • navigator.onLine becomes false
  • Network requests fail immediately
  • online and offline events fire
  • Your connectivity monitor should activate

Testing Checklist

With DevTools throttling, verify:

  • Offline UI indicators appear when you go offline
  • Failed requests trigger appropriate error messages
  • Retry logic activates with proper delays
  • Online events restore functionality when you toggle back
  • Forms queue data instead of losing it
  • Active connectivity checks detect the offline state

Think of DevTools throttling as a network weather simulator—you can create storms, droughts, or clear skies on demand to see how your app handles each condition.

Key Takeaway: DevTools network throttling and offline simulation let you rigorously test connectivity handling without physically disrupting your network, ensuring your offline strategies work before users encounter real network issues.