Retrieving which tabs are open in Chrome?
Yes, here is how you can do this:
Note: this requires permission "tabs" to be specified in your manifest file.
chrome.windows.getAll({populate:true}, getAllOpenWindows);
function getAllOpenWindows(winData) {
var tabs = [];
for (var i in winData) {
if (winData[i].focused === true) {
var winTabs = winData[i].tabs;
var totTabs = winTabs.length;
for (var j=0; j<totTabs;j++) {
tabs.push(winTabs[j].url);
}
}
}
console.log(tabs);
}
In this example I am just adding tab url as you asked in an array but each "tab" object contains a lot more information. Url will be the full URL you can apply some regular expression to extract the domain names from the URL.
php javascript update a div in all opened tabs of a site in browser
I have done this with AJAX and works fine, updating on all pages when database has changes, whatever page is opened in multiple tabs of a browser.
$(document).ready(function(){
var currentData = "";
function auto_load(){
$.ajax({
type: 'POST',
url: 'menu_update_total_items.php',
success: function(data){
if(currentData != data) {
$('.summary12').html(data);
currentData = data;
}
}
});
}
auto_load();
setInterval(auto_load,1000);
});
how to find particular site is already open or not in the browser?
There is no way to run any client side code in an HTML formatted email. So this is impossible.
The closest you could come would be to:
- use some kind of token to identify a user (e.g. stored in a cookie)
- run some heart beat code to see if they are still on the page (e.g. use XMLHttpRequest to request a 1 byte file every 15 seconds using a page id generated when the page was loaded and the user id in the cookie)
- check on the server to see if a heart beat from a different page was received recently when a new copy of the page is loaded
- serve different content if it is
How to get browser's current page URL from iframe?
You probably don’t need the “actual URL”, but only the page id, I assume …? That you can get by decoding the signed_request
parameter that gets POSTed to your app on initial load into the iframe.
How to “decode” it is described here, https://developers.facebook.com/docs/facebook-login/using-login-with-games#parsingsr
If you’re using the PHP SDK, that has a method already that does this for you.
How to fetch URL of current Tab in my chrome extension using javascript
Note you must have the tabs
permission set in your manifest file
"permissions": [
"tabs"
],
http://developer.chrome.com/extensions/tabs.html
or the activeTab
permission if initiated by a click on the extension button[Xan]
https://developer.chrome.com/extensions/activeTab
Code:
chrome.tabs.query({currentWindow: true, active: true}, function(tabs){
console.log(tabs[0].url);
});
Related Topics
The Get Method Is Not Supported for This Route. Supported Methods: Put. But I'M Using Put
What Is the Default Username and Password of Phpmyadmin
Change Language of Site With a HTML Button
Fatal Error: Call to Undefined Function Mysqli_Connect()
Warning: Preg_Replace(): Unknown Modifier
How to Get Time Difference in Minutes in PHP
Laravel - Display a Pdf File in Storage Without Forcing Download
How to Enable the Mysqli Extension in PHP 7
Merging Two Json by Adding Their Value
Multiple Column With Same Search String in Laravel
On a Function That Gets Settings from a Db I Ran into the Error
Session Destroy When One Browser Tab Gets Closed