diff --git a/maps.py b/maps.py
index f9ae6fad1..d92238b34 100644
--- a/maps.py
+++ b/maps.py
@@ -10,6 +10,7 @@ __module_group__ = "Core"
import os
from flags import is_float
+from utils import browser_supports_download_filename
from utils import get_url_from_post
from utils import acct_dir
from utils import load_json
@@ -897,7 +898,7 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
description = period_str
if translate.get(period_str):
description = translate[period_str]
- if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
+ if browser_supports_download_filename(ua_str_lower):
html_str += '' + \
description + ''
diff --git a/utils.py b/utils.py
index 70c2ebf55..d78547a8c 100644
--- a/utils.py
+++ b/utils.py
@@ -5277,3 +5277,14 @@ def set_searchable_by(base_dir: str, nickname: str, domain: str,
fp_search.write(searchable_by)
except OSError:
print('EX: unable to write searchableByDropdown ' + filename)
+
+
+def browser_supports_download_filename(ua_str: str) -> bool:
+ """Does the browser indicated by the user agent string support specifying
+ a default download filename?
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
+ https://www.w3schools.com/howto/howto_html_download_link.asp
+ """
+ if 'mozilla' in ua_str or 'firefox' in ua_str:
+ return True
+ return False
diff --git a/webapp_calendar.py b/webapp_calendar.py
index 6df948899..587e5f574 100644
--- a/webapp_calendar.py
+++ b/webapp_calendar.py
@@ -10,6 +10,7 @@ __module_group__ = "Calendar"
import os
from datetime import datetime
from datetime import date
+from utils import browser_supports_download_filename
from utils import remove_html
from utils import get_display_name
from utils import get_config_param
@@ -347,7 +348,7 @@ def _html_calendar_day(person_cache: {}, translate: {},
# icalendar download link
ua_str_lower = ua_str.lower()
- if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
+ if browser_supports_download_filename(ua_str_lower):
default_cal_filename = 'calendar_day.ics'
calendar_str += \
'