Added can_write_to_storage detection to prevent private browsing issues with Safari.