从身份验证页面返回后,是否可以保留全局变量`窗口.__ tauri__“?

发布于 2025-01-23 06:54:57 字数 354 浏览 0 评论 0原文

我正在使用单登录的公司设置中使用陶里。当我提供网页时,它将重定向到身份验证页面,然后将其转发到我的原始URL。

我有withglobaltauri设置为true,但是window .__ Tauri __从身份验证返回时会删除对象。

我了解加载新页面时应该清除窗口对象,但是Tauri是否有可能在新页面加载上重新注射全局Tauri变量?以及如何?

还是我唯一的重新加载陶里作为模块的选择?如:

import { invoke } from '@tauri-apps/api/tauri'

I'm using Tauri in a corporate setting with single sign-on. When I serve my webpage, it redirects to an authentication page and then forwards on to my original url.

I have withGlobalTauri set to true, but the window.__TAURI__ object is deleted when returning from authentication.

I understand the window object is supposed to be cleared when loading new pages, but is it possible for tauri to reinject the global tauri variable on new page loads? and how?

Or is my only option to reload tauri as a module? as in:

import { invoke } from '@tauri-apps/api/tauri'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千鲤 2025-01-30 06:54:57

我收到一个答案,

  1. 我们不会将Tauri API注入外部URL,我想一旦您不在上下文之外,您就无法(当前)
  2. 它不清楚地定义了当您导航回Tauri时真正期望的是什么 上下文
  3. 无论如何,建议使用NPM模块而不是全局模块的

(较小的应用程序大小,更好的安全性),因此不,不应该保留全局变量,无论如何最好将其用作导入语句。

I received an answer that

  1. we don't inject the tauri api into external urls and I guess once you're outside the context you can't get into it (currently)
  2. it's not clearly defined what's really expected when you navigate back to the tauri context
  3. using the npm module instead of the global one is recommended anyway (smaller app size, better security)

So no, the global variable is not supposed to be retained, and it's better to use as an import statement anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文