google-chrome-extension


How do we get the parent tab URL of the current chrome tab?


On my application home page, there is a link which opens a new tab when clicked.
After some research, I found below code which gets triggered when a new chrome tab is launched. The "active_tab" object below gives information about the current tab.
But how do we get the Parent tab URL (previous active tab) here ? Please help.
I need to get my Home page url here from which this active_tab is launched.
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, function(active_tab){
alert(active_tab.url);
/* code */
});
});
Thanks #wOxxOm.
Used the openerTabId property to get parent tab.
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, function(active_tab){
chrome.tabs.get(active_tab.openerTabId, function(parent_tab){
alert(parent_tab.url);
});
});
});

Related Links

Replacing my popup.html dynamically
Calling chrome.browserAction.setIcon from content script the way it is done in background script
Is it possible to control position of page action in chrome extension?
Sending a webpage from google chrome extension to a desktop app
Chrome Extension - Take screenshot from a URL without showing the page in a tab
load extensions after google search page is loaded
Get tab when mouse is over
Is there any way to get access to Chrome's theme favicons?
Chrome Extension Popup is too high when first click
Returning an element value from chrome.tabs to a background script
insert data from filestream in local storage chrome extension
Making extension always opened once the user clicked in the extension icon, only close when the extension icon is clicked
Where can I see which chrome extensions API is valid for which chrome version
Create table and insert data in local storage of Chrome extensions
How can I trigger a content script to run when I click the popup icon of a Google Chrome extension?
How can I efficiently overwrite CSS with a content script?

Categories

HOME
cakephp
pandas
hook
magnific-popup
hashmap
google-docs
callback
amazon-cloudformation
n-gram
moonmail
visual-studio-cordova
windows-server-2012
iolanguage
oracle-coherence
paging
clickonce
sox
wkwebview
wijmo
opennlp
vlsi
info.plist
phpfox
maxmind
atlassian-crucible
junit5
iframe-resizer
bower-install
adobe-premiere
libvpx
twitch
document.write
user-controls
dynamic-reports
firebase-admin
fakeiteasy
scorm
babel-core
parentheses
apache-fop
sage-one
mu
crypt
namecoin
jspdf-autotable
minimization
query-performance
google-cdn
yt-project
angular-strap
xcb
ableton-live
nxt
essence
ptrace
r-tree
endeca-workbench
t4mvc
wireshark-dissector
tableau-online
graph-drawing
system32
nsmutabledictionary
modalpopup
camanjs
network-interface
bitcoinj
tld
valuechangelistener
seaside
centos5
intentservice
prettify
mysqltuner
quantlib-swig
sqlperformance
dsn
getmessage
enter
netbeans-6.9
vdsp
xmemcached
mysql-error-1005
telerik-scheduler
yslow
gamequery
gamma
ncqrs
memory-size
libs
adrotator
ctp4

Resources

Encrypt Message