autokap 1.3.24 → 1.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +18 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -929,6 +929,24 @@ export class Browser {
|
|
|
929
929
|
storageState: options.storageState,
|
|
930
930
|
};
|
|
931
931
|
instance.context = await instance.browser.newContext(contextOptions);
|
|
932
|
+
// Cloud Run only: inject the notranslate meta on every navigation so
|
|
933
|
+
// Chromium's translate UI never prompts. The --disable-features=Translate*
|
|
934
|
+
// launch flags are unreliable across Chromium versions (some translate
|
|
935
|
+
// surfaces are still gated by other features), but `<meta name="google"
|
|
936
|
+
// content="notranslate">` is Google's official, page-level opt-out
|
|
937
|
+
// mechanism — Chrome respects it regardless of feature flags. The
|
|
938
|
+
// `translate="no"` html attribute is the W3C standard backup. Both run
|
|
939
|
+
// BEFORE page scripts via addInitScript, so they're in the DOM by the
|
|
940
|
+
// time Chromium decides whether to show the translate bubble.
|
|
941
|
+
if (isLinuxWithGpu) {
|
|
942
|
+
await instance.context.addInitScript(() => {
|
|
943
|
+
const meta = document.createElement('meta');
|
|
944
|
+
meta.setAttribute('name', 'google');
|
|
945
|
+
meta.setAttribute('content', 'notranslate');
|
|
946
|
+
(document.head ?? document.documentElement).appendChild(meta);
|
|
947
|
+
document.documentElement.setAttribute('translate', 'no');
|
|
948
|
+
});
|
|
949
|
+
}
|
|
932
950
|
// Inject cursor overlay at context level — survives all navigations in this session
|
|
933
951
|
await instance.context.addInitScript(cursorScript);
|
|
934
952
|
// Also hide dev/prototype chrome on every document, including navigations
|