browser-tab

Store browser tab specific data

倖福魔咒の 提交于 2019-12-03 11:03:50
I have a web application that store information about recently visited pages, let's call them A. When a user visits another page type, called B, I render a menu at the top with a button to point to the most recently visited A-page. The B-pages are accessible either through an A page or a B page and can by the user be considered a property of A. This works fine but it becomes a problem when someone opens two tabs and when being on a B-page in tab 1 with a link to the A-page A1 they open a new tab and visits the A-page A2. When the user then refreshes the B-page in tab 1 the menu changes to A2.

Chrome-Extension: iterate through all tabs?

一笑奈何 提交于 2019-12-03 01:17:37
How would I iterate through all tabs a user has open and then check if they have a particular HTML item with id = 'item' ? You can make it like this : chrome.tabs.getAllInWindow(null, function(tabs){ for (var i = 0; i < tabs.length; i++) { chrome.tabs.sendRequest(tabs[i].id, { action: "xxx" }); } }); After that to look after your item, if you can make it like this : document.getElementById('item') Don't forget that you can't manipulate the HTML by using the "background page" So the first code snip is for the background page, and the second have to be on a content script ;) Golden Flying Broom

Restriction on number of opened tabs

南笙酒味 提交于 2019-12-01 23:39:21
问题 There are some links on web-page. On right click there is option of 'open link in new tab'(browser option). I want to restrict user for not opening more that two tabs? How can i do this? <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <

Get Browser Tab Index/Id

吃可爱长大的小学妹 提交于 2019-12-01 15:37:50
So in most current browsers there is the feature of Tabs, is there a way to get the Tab index? so Tab 1 has www.google.com opened in it and Tab 2 has www.google.com opened in it, is there a way to identify what the Tab index is? Pseudo Code: if($tab == 2) { alert "Tab 2 is active\n"; } if($tab == 1) { alert "Please use Tab 2 as this is Tab 1\n"; } Funny as everything I search for about tabs is related to the tab index of the webpage itself, sigh... Strictly speaking. TABS are on the end user's machine. PHP works on the server. PHP can't see what the end user's machine is doing, it can only

Minimum setInterval()/setTimeout() delay on background tabs [duplicate]

∥☆過路亽.° 提交于 2019-12-01 06:42:09
Possible Duplicate: Chrome: timeouts/interval suspended in background tabs? Is there a minimum allowed delay for setInterval() and setTimeout() when being run on a tab you're not currently looking at? This code runs setInterval() with a specified delay of 100ms and writes out how long the delay actually was. It also reports when you enter/leave the tab. <html> <body> <script type="text/javascript"> window.onfocus = function () { document.body.innerHTML += 'entered tab<br />'; }; window.onblur = function () { document.body.innerHTML += 'left tab<br />'; }; var previous = new Date().getTime();

Minimum setInterval()/setTimeout() delay on background tabs [duplicate]

为君一笑 提交于 2019-12-01 05:07:12
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Chrome: timeouts/interval suspended in background tabs? Is there a minimum allowed delay for setInterval() and setTimeout() when being run on a tab you're not currently looking at? This code runs setInterval() with a specified delay of 100ms and writes out how long the delay actually was. It also reports when you enter/leave the tab. <html> <body> <script type="text/javascript"> window.onfocus = function () {

check if a browser tab is already open so I don't make extra tabs

£可爱£侵袭症+ 提交于 2019-12-01 03:41:38
When a user adds an item to our shopping cart it opens our store in a new tab. Different websites oddly enough. I would like to check if the tab is already open and then repopulate it it with the second item instead of opening another tab with the updated cart. Is there a way to check this with js? I imagine I can track that we opened the tab but I don't see how I can confirm that it wasn't closed in the time between adding items to the cart without doing some ajax requests pinging both pages etc. Which seems like overkill. So simply how do you check if a browser tab is already open? Edited

How to know if browser tab is already open using Javascript?

混江龙づ霸主 提交于 2019-11-28 19:39:48
How to know or check if the two browser tab is already open and if those tab are open, the user will receive an alert box or msg box saying that 'the url is already open', something like that, in pure/native JavaScript? This browser tab is contain an external website which is I don't have any privileges to manipulate or change it. Thanks Example URLs yahoo.com and google.com I want to alert the user if there's already open tab for yahoo.com and google.com And I want to use tabCreate to open the url like this: tabCreate("http://maps.google.com/", "tabMapsPermanentAddress"); mean to open a new

Switch between browser tabs using Selenium WebDriver with Java

萝らか妹 提交于 2019-11-28 07:35:54
问题 I need to switch between the browser tabs, used the following code, driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"\t"); It was working properly sometimes only, but sometimes it is showing an exception. Can anyone suggest me is there any other instructions for switching tabs within a single window by using java. 回答1: You have to use window handle function here. Here is a sample working code in java: String parentHandle = driver.getWindowHandle(); // get the current window

Selenium 2: Open link in new tab and close tabs

前提是你 提交于 2019-11-27 20:14:40
I want to be able to open a link in a new tab in Selenium 2. Also i want to close the tab when i am finished interacting with the page. How is this possible if I have a WebElement of an <a> tag? I am using the Java API of Selenium 2 with the Firefox Driver, running on Firefox 4. At the moment, the Selenium WebDriver API doesn't have any way of handling tabs. The project would really need a consistent, cross-browser set of methods for managing tabs before I would expect to see an implementation in one of the language bindings like Java. Until then, your JavaScript solution may be the only way,