问题标签 [browser-tab]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
414 浏览

jsf - JSF 1.2 中每个选项卡一个会话

我正在开发一个 JSF 1.2 应用程序。考虑以下使用带有 2 个选项卡的浏览器的用例:

  1. 在第一个选项卡中,我使用用户“TEST”登录。
  2. 在第二个选项卡中,我使用用户“TEST2”登录。
  3. 当我返回第一个选项卡时,登录用户更改为“TEST2”。

如何将登录限制为当前选项卡而不是所有选项卡?换句话说,如何将 HTTP 会话限制为一个选项卡,而不是浏览器实例的所有选项卡?

0 投票
2 回答
929 浏览

javascript - 如何检索以前打开的窗口的 URL?

我正在打开一个这样的窗口:

然后我使用一些动态数据创建一个 URL,并将窗口设置为该 URL,如下所示:

我的问题是我需要检索之前设置到窗口的 URL 以便稍后进行编辑。这样做不起作用:

因为在我的情况下这违反了安全性并触发了异常。

我不能只将 URL 保存为“全局”变量,因为这需要跨页面工作。我不想使用 cookie,因为当窗口关闭时URL应该被重置。使用 cookie 会增加更多复杂性,因为它会迫使我在窗口关闭之前进行清理,并且会增加错误风险。我会用它作为最后的手段。

在将 URL 设置为不同域上的内容后,有什么方法可以检索窗口实例的 URL?

0 投票
0 回答
60 浏览

javascript - 如何在使用 JavaScript 不活动时重命名 Google 地图的标题页并隐藏浏览器选项卡?

如何在不影响使用纯/原生 JavaScript 的搜索栏的情况下重命名谷歌地图的标题页?因为当我尝试更改它时,搜索栏受到影响,无论我放什么标题,它也会显示在搜索栏中,如何避免在谷歌地图的搜索栏中显示标题?如果用户使用纯 JavaScript 切换到另一个选项卡,我如何隐藏或关闭浏览器选项卡?

Example: When the tab is open the Google Map, and the user switch into another tab, the Google Map tab will be hide or closeThank you

我在谷歌上搜索了很多小时,但什么也没找到,我看到的所有脚本都是用 JQuery 制作的,而不是用原生/纯 JavaScript 制作的

0 投票
4 回答
9545 浏览

javascript - Javascript Cannot Close Current Tab After Chrome 36.0.1985.125 Update

Currently I have an application where a user hits a clicks on a URL and goes to my form. The user then enters his information into the form field, which is then sent through jquery ajax to a PHP script which enters it into the database. Upon success callback, it would alert the user that they had been registered and closes the current browser tab. (Let's just say I need the closing the browser tab behaviour to persist).

I understand that most modern browsers (Chrome included) are limiting the ability for javascript to only close tabs/windows it created for security reasons. Temporarily I had used open(location, '_self').close(); to get around the issue, but alas, it seems chrome's most recent update prevents you from doing this as well (Prompts you with a warning: 'Scripts may close only the windows that were opened by it'.)

Is there a way around this? I'm not talking about something along the lines of:

But something that will work all the time on Chrome (e.g. changing a Chrome setting to allow scripts to close tabs/windows (similar to how this could be done through about:config in Firefox) or a way of restructuring how the user hits the form, so that the window object is available in javascript so i can call windowObject.close(); ) .

Thanks in Advance!

0 投票
3 回答
46809 浏览

java - 使用 Selenium WebDriver 和 Java 在浏览器选项卡之间切换

我需要在浏览器选项卡之间切换,使用以下代码,

它有时只能正常工作,但有时会显示异常。任何人都可以建议我是否有任何其他说明可以通过使用 java.util 来在单个窗口中切换选项卡。

0 投票
5 回答
38973 浏览

javascript - 如何知道浏览器选项卡是否已经使用 Javascript 打开?

如何知道或检查两个浏览器选项卡是否已打开,如果这些选项卡已打开,用户将收到一个警告框或消息框,提示“网址已打开”,类似这样的纯/原生 JavaScript?此浏览器选项卡包含一个外部网站,我没有任何权限来操作或更改它。谢谢

示例网址

如果 yahoo.com 和 google.com 已经打开标签,我想提醒用户

我想使用 tabCreate 打开这样的网址:

0 投票
1 回答
799 浏览

asp.net-mvc - 将 ID 从浏览器选项卡/窗口/页面传递到服务器 (ASP.NET MVC)

我通过javascript在客户端的会话存储中创建并保护浏览器Windows GUID。所以它一直存在,直到标签关闭。

现在我想将这个特定浏览器窗口的每个请求的信息传递到服务器端,这样我就可以随时访问它,而无需将它与模型一起传递。

我使用 ASP.NET MVC。因此,如果我是对的,则没有可用的 ViewState。

我考虑过在 HTTP 标头或类似的东西中添加和访问自定义字段。我试图找到一些东西来完成它。所以我需要一些想法。

谢谢

(对不起。英语不是我的第一语言)

0 投票
2 回答
2984 浏览

javascript - setInterval() 不适用于非活动选项卡

我正在开发一个记录时间的计时器。因为我正在使用 java 脚本的 setInterval 方法,现在的问题是如果选项卡处于非活动状态,它就不能正常工作。

一种解决方案我必须存储旧时间并从新时间中减去一个问题,如果在启动计时器后如果用户更改系统时间那么它会影响我的计时器。如果有任何其他可能的方法或解决方案,请告诉我。

0 投票
1 回答
981 浏览

javascript - 是否可以为每个选项卡生成唯一 ID?

是否可以为每个浏览器选项卡生成唯一 ID 并在每次我提交或单击页面上的 AJAX 链接时发送它。我想用这个 ID 进行会话控制。

或者除了在 url 中保留一个 id 之外,还有其他用于多选项卡会话控制的解决方案吗?

先感谢您。

更新情况: 我有一个基于文档的表单页面,其中有一些弹出窗口和 ajax 链接来更新我在会话中保存的数据。那么如果用户在多个选项卡中打开此表单,我该如何区分一个页面?

0 投票
0 回答
82 浏览

internet-explorer - url redirection not happening in IE in crossrider extension

I am trying to open a url by using crossrider API in my extension

I am trying to open url as new tab and getting the following error. and some parameters from my url are missing when i see my server accesslog.

This works fine in firefox though.

Error image