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

Chrome: Installing local extention (.CRX file)
Reading policy properties from a chrome app
Steps for Syncing data by using chrome.storage.sync [Chrome Extension]
Creative pen tablet
Chrome onBeforeSendHeaders not catching FTP request
Easy way (firefox module? chrome plug-in?) to automate websites with forms
How to get openerTabId from inactive tab
Click text then appear a icon next to text and can click when use chrome extension
Chrome extension, programmatic injection of contentscripts
Need Help - Building Chrome Extension Window Object With Custom Tools
XDebug Helper IDE Key for Atom
mDNS and Sockets for Chrome Extensions
Web Scraping with a Google Chrome Extension - best current solutions?
Runtime, extension or tabs to send a message from background to content script?
Chrome setUninstallURL is not capturing all uninstall events
google admin sdk retrieve chromebook hardware

Categories

HOME
compiler-construction
yii2
debugging
urbancode
push-notification
cvs
microservices
icloud
serverspec
convolution
in-app-purchase
autotools
webrequest
google-cloud-ml
commonmark
fatal-error
reactive-cocoa
pythonanywhere
amazonsellercentral
jquery-ajaxq
pass-by-reference
telerik-reporting
rundeck
facebook-access-token
react-css-modules
maxmind
skia
socialengine
twilio-api
semantic-versioning
contact-form
stringtemplate
disassembling
sharefile
hilbert-curve
squib
particles.js
preconditions
fedex
glew
ibpy
convertapi
wso2carbon
logfiles
dotcover
kbuild
sqlclient
google-perftools
akka-cluster
mcafee
iso8601
jspdf-autotable
heidisql
gridpane
infix-notation
python-stackless
uid
r-tree
endeca-workbench
libressl
security-testing
rgeo
microbenchmark
twirl
unity5.2.3
javax.mail
bigbluebutton
operator-precedence
typekit
qcodo
valuechangelistener
hyprlinkr
fmod
page-layout
orchardcms-1.7
interface-orientation
runas
ohm
heartbeat
horizontal-accordion
locate
createwindow
gin
vc90
thunderbird-lightning
adrotator
avatar
boost-smart-ptr
ubuntu-9.04
mdac

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile