Skip to content

Fix app broken on Windows due to IE Compatibility Mode#211

Merged
lstein merged 4 commits intomasterfrom
copilot/fix-cannot-index-album
Apr 4, 2026
Merged

Fix app broken on Windows due to IE Compatibility Mode#211
lstein merged 4 commits intomasterfrom
copilot/fix-cannot-index-album

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

Fixes the app on Windows where legacy Microsoft Edge (EdgeHTML / Edge 44) fails to run the application due to incompatible JavaScript.

Changes Made

  • Browser detection: Added an inline script to main.html (before any external scripts) that detects legacy EdgeHTML via window.StyleMedia with an optional-chaining syntax probe as fallback, then immediately calls window.location.replace("/static/unsupported-browser.html") to navigate away before any ES2020 code loads. This avoids the race condition where document.write() would be overwritten by the rest of the original page after ~5 seconds.
  • Upgrade instructions page: Added static/unsupported-browser.html — a standalone styled page that tells the user they are on Microsoft Edge (Legacy), and provides step-by-step instructions to install the new Chromium-based Edge. Chrome and Firefox are also mentioned as alternatives.
  • Cleanup: Removed a stale placeholder comment from main.html.
  • HTML fix: Changed <path ... /> to <path ...></path> in metadata-drawer.html to resolve HTML1500 errors.

Testing

  • ✅ Added test_legacy_edge_detection_script_present — asserts the detection probe and redirect path are present in the served HTML
  • ✅ Added test_unsupported_browser_page_served — asserts the static warning page is served and contains the upgrade link
  • ✅ All 6 backend tests pass

Copilot AI linked an issue Apr 4, 2026 that may be closed by this pull request
- Add IECompatibilityMiddleware to FastAPI server that adds
  X-UA-Compatible: IE=edge header to all responses, preventing
  Edge/IE from entering IE Compatibility Mode which caused:
    * SCRIPT1028 (Swiper v11 modern JS syntax failure)
    * HTML1416 (-- inside HTML comments)
    * HTML1500 (self-closing non-void tag)
- Add <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to
  main.html as a belt-and-suspenders measure
- Fix -- inside HTML comments in control-panel.html and search-panel.html
  (replace -- with : to avoid HTML1416 in SGML-strict parsers)
- Fix self-closing <animateTransform /> in spinner.html with explicit
  closing tag to avoid HTML1500
- Add tests verifying X-UA-Compatible header on HTML and API responses

Agent-Logs-Url: https://github.com/lstein/PhotoMapAI/sessions/907b9c95-1c90-4b09-b532-a2f69f736312

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue preventing album indexing Fix app broken on Windows due to IE Compatibility Mode Apr 4, 2026
Copilot AI requested a review from lstein April 4, 2026 01:57
@lstein lstein marked this pull request as ready for review April 4, 2026 02:35
@lstein
Copy link
Copy Markdown
Owner

lstein commented Apr 4, 2026

@copilot On older edge browsers, the "Browser not Supported" message appears for about 5 seconds, and is then replaced by the nonfunctional screen reported in the original issue. With the newer edge, the application is working properly.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 4, 2026

@copilot On older edge browsers, the "Browser not Supported" message appears for about 5 seconds, and is then replaced by the nonfunctional screen reported in the original issue. With the newer edge, ...

Fixed in c5b61c1. The root cause was that document.write() + document.close() only controls the write stream — the browser's HTML parser still feeds the rest of main.html into the page afterwards, overwriting the warning after ~5 seconds.

The fix replaces document.write() with window.location.replace("/static/unsupported-browser.html"). This triggers a full navigation away from main.html the moment legacy Edge is detected, so the original page never finishes loading and the warning page sticks permanently. The warning content has been moved to a proper static HTML file at photomap/frontend/static/unsupported-browser.html.

Copy link
Copy Markdown
Owner

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised.

@lstein lstein merged commit 0733fbf into master Apr 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't index any album

2 participants