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 tabs query title pattern ignore case
How to access file and directory structure outside the sandbox from chrome extension?
JSONP query to WebApp from Chrome Extension?
Showing messages and errors to users, alternative to alert()
Injecting iframe into page with restrictive Content Security Policy
chrome.runtime.sendMessage inside background page of extension
How to find out if a user is dragging a tab
Chrome extension can not inject my script to iframe that created by tinyMCE
cors+s3+browser cache+chrome extension
Chrome Extension : Capture network log without opening developer tools
What api to use in crossrider extension to schedule code to run periodically
Changing html content onclick chrome extension
Why doesn't this URL scheme match my URL?
Chrome Extension port.onDisconnect listener for native connection is not getting called when the native app shuts down
How to interface a Chrome extension with another program?
Popup page remains activated even if the page is gone

Categories

HOME
oracle11g
server
pycharm
electron
cmd
tizen-web-app
jpeg
fingerprint
fancybox
pheatmap
primary-key
maude-system
communication
alignment
fortumo
serverless-framework
workload-scheduler
systemc
google-cloud-speech
paging
web-sql
core-text
hammerspoon
angular2-aot
chromebook
url-scheme
info.plist
uninstall
siesta-swift
catel
uiswipegesturerecognizer
environment-modules
git-merge
adobe-premiere
vapor
bootstrapper
greenrobot-eventbus
dism
sas-visual-analytics
core-plot
slick-3.0
apple-news
parentheses
jedis
zip4j
promela
paxos
worksheet
lowpass-filter
crypt
windows-mobile-6.5
flutterwave
jspdf-autotable
django-scheduler
webdriverjs
blacklist
android-fonts
nxt
removechild
azure-sdk
rotativa
probability-density
slicknav
etsy
jwplayer7
react-native-listview
skype4py
rvest
dataview
ios4
wapiti
system.management
netmq
tcpserver
maven-tomcat-plugin
purge
angular-leaflet-directive
twirl
web-controls
umbraco6
coldbox
android-imagebutton
relocation
phalanger
codeigniter-routing
rdtsc
xojo
elliptic-curve
uv-mapping
cdc
gwt-rpc
html4
plasma
html-editor
browser-detection
chuck
gil
dbproviderfactories
gnustep
external-accessory
pyinotify
mysql-error-1005
sortable-tables
jquery-ui-droppable
bespin
data-driven

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile