简体   繁体   English

Asto SSR 生成的代码不能在旧版本的 iOS 上运行

[英]Asto SSR generated code doesn't run on older versions of iOS

I am hosting astro SSR site on Netlify.我在 Netlify 上托管 astro SSR 站点。 It works well everywhere except when I test on iPhone 6 and older.除了我在 iPhone 6 及更早版本上测试时,它在任何地方都运行良好。 Basically all script executions are stopped and the site is no longer interactive.基本上所有脚本的执行都停止了,站点不再具有交互性。

Errors from Safari on iPhone 5SE Simulator:来自 Safari 在 iPhone 5SE 模拟器上的错误:

[Error] SyntaxError: Unexpected token '.'

[Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

[Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored. (x2)

[Error] Unhandled Promise Rejection: SyntaxError: Unexpected token '?'

[Error] Unhandled Promise Rejection: SyntaxError: Unexpected token '?'

在此处输入图像描述

在此处输入图像描述

I am not really sure how to fix this issue.我不太确定如何解决此问题。 Any help would be appreciated.任何帮助,将不胜感激。

PS: I used svelte for building astro islands and google recaptcha(v3) in the page that is being tested. PS:我在正在测试的页面中使用 svelte 构建 astro islands 和 google recaptcha(v3)。 The page works fine on development environment.该页面在开发环境中运行良好。

This sounds like you have some code using optional chaining, eg object?.potentiallyMissingProperty .这听起来像是您有一些使用可选链接的代码,例如object?.potentiallyMissingProperty Per caniuse , this only works on iOS Safari versions 13.4 and later. Per caniuse ,这仅适用于 iOS Safari 版本 13.4 及更高版本。 An iPhone 6 can only install iOS 12, so using this syntax will throw an error on those devices. iPhone 6 只能安装 iOS 12,因此使用此语法会在这些设备上引发错误。

This appears to be an issue within Astro , which does not support some older browsers.这似乎是Astro 中的一个问题,它不支持某些较旧的浏览器。 Astro also scopes CSS with :where , which will also break on older versions of Safari . Astro 还使用:where限定 CSS 的范围,这也会在旧版本的 Safari 上中断 On those browsers, your page's HTML should render, but any JavaScript will not work and should be treated as a progressive enhancement.在这些浏览器上,您页面的 HTML 应该呈现,但任何 JavaScript 都不会工作,应该被视为渐进增强。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM