Fix Cloudflare 'StorageType.persistent is deprecated' Error in Google Lighthouse

June 21, 2025
17 views

Overview

When running Google Lighthouse audits on your website, you may encounter a Best Practices warning that significantly impacts your score:

Error Message:

'StorageType.persistent' is deprecated. Please use standardized 'navigator.storage' instead

This error originates from Cloudflare's Bot Management JavaScript and can reduce your Lighthouse Best Practices score. The issue stems from Cloudflare using outdated Web API methods in their bot detection scripts.

Lighthouse Error Image 1

Why This Happens

Cloudflare's Bot Management feature injects JavaScript code that uses the deprecated StorageType.persistent API instead of the modern navigator.storage.persist() method. This has been a persistent issue for several years, with Cloudflare being slow to update their implementation.

Community Discussion:

Impact on Your Website

  • Lower Lighthouse scores - Affects Best Practices rating
  • Console warnings - Clutters browser developer console
  • Future compatibility - May break when browsers remove deprecated APIs
  • SEO implications - Google considers Core Web Vitals and Lighthouse scores for ranking

Solution: Disable JavaScript Detections

Step 1: Access Cloudflare Dashboard

  1. Log in to your Cloudflare dashboard
  2. Select the domain experiencing the issue
  3. Navigate to SecuritySettingsBot traffic

You should see the Bot Management configuration panel:

Cloudflare Bot Management Settings

Step 2: Disable JavaScript Detections

In the Bot Management settings:

  1. Locate the JavaScript Detections option in the right-hand column as shown below
  2. Toggle the switch to OFF (disabled)
  3. The change will be applied automatically

Disable JavaScript Detections

Important: This setting may take a few minutes to propagate across Cloudflare's global network.

Step 3: Verify the Fix

After disabling JavaScript Detections:

  1. Run a new Lighthouse audit
  2. Check that the StorageType.persistent error is resolved

Lighthouse Fixed Result

Conclusion

Disabling Cloudflare's JavaScript Detections is an effective solution for the StorageType.persistent deprecation warning. However, keep in mind the following benefits/considerations:

Benefits:

  • Eliminates Lighthouse Best Practices warnings
  • Improves page performance slightly
  • Removes deprecated API console errors
  • Better Core Web Vitals scores

⚠️ Considerations:

  • Slightly reduced bot protection
  • Possible need for alternative security measures
  • Ongoing monitoring requirements
  • Potential impact on high-risk sites

Recommendation: This solution works best for content sites, blogs, and marketing pages where the SEO benefits outweigh the minimal security trade-offs. For e-commerce or high-security applications, consider alternative solutions or additional security measures.


0 Comments


Leave a Comment

Share your questions, thoughts and ideas while maintaining a considerate tone towards others, thank you.

All fields are required - your email address will not be published.