Chrome extension: how to get newly created tab urlHow do you get a timestamp in JavaScript?How to get the children of the $(this) selector?Get current URL with jQuery?How do I modify the URL without reloading the page?How can I get query string values in JavaScript?Get the current URL with JavaScript?How do I get the current date in JavaScript?Open a URL in a new tab (and not a new window) using JavaScriptHow to detect tabs change URLs or tabs create on Google Chrome Extension?capture URL in chrome extension
What is the purpose of using a decision tree?
What do the positive and negative (+/-) transmit and receive pins mean on Ethernet cables?
How to test the sharpness of a knife?
is this saw blade faulty?
Sort with assumptions
Can creatures abilities target that creature itself?
C++ lambda syntax
What is the period/term used describe Giuseppe Arcimboldo's style of painting?
Is there a distance limit for minecart tracks?
Calculate Pi using Monte Carlo
Taking the numerator and the denominator
Asserting that Atheism and Theism are both faith based positions
Why would five hundred and five same as one?
What (if any) is the reason to buy in small local stores?
How can a new country break out from a developed country without war?
Why didn’t Eve recognize the little cockroach as a living organism?
How do you say "Trust your struggle." in French?
Air travel with refrigerated insulin
categorizing a variable turns it from insignificant to significant
Offset in split text content
Do I have to take mana from my deck or hand when tapping this card?
How do I lift the insulation blower into the attic?
Why does the frost depth increase when the surface temperature warms up?
Output visual diagram of picture
Chrome extension: how to get newly created tab url
How do you get a timestamp in JavaScript?How to get the children of the $(this) selector?Get current URL with jQuery?How do I modify the URL without reloading the page?How can I get query string values in JavaScript?Get the current URL with JavaScript?How do I get the current date in JavaScript?Open a URL in a new tab (and not a new window) using JavaScriptHow to detect tabs change URLs or tabs create on Google Chrome Extension?capture URL in chrome extension
In my extension/addon background script I'm having issues trying to a new tab's url, it keeps coming back with 'about:blank', which is fair enough if it hasn't loaded properly yet.
My question is how do you get the url of a newly created tab as soon as it is ready?
browser.tabs.onCreated.addListener(function(tab)
var m_Url = tab.url;
console.log("m_Url: " + m_Url);
);
javascript
add a comment |
In my extension/addon background script I'm having issues trying to a new tab's url, it keeps coming back with 'about:blank', which is fair enough if it hasn't loaded properly yet.
My question is how do you get the url of a newly created tab as soon as it is ready?
browser.tabs.onCreated.addListener(function(tab)
var m_Url = tab.url;
console.log("m_Url: " + m_Url);
);
javascript
2
Does it work better to useonUpdatedand look forchangeInfo.urlchanges?
– Mattias Wadman
Mar 7 at 0:53
1
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17
add a comment |
In my extension/addon background script I'm having issues trying to a new tab's url, it keeps coming back with 'about:blank', which is fair enough if it hasn't loaded properly yet.
My question is how do you get the url of a newly created tab as soon as it is ready?
browser.tabs.onCreated.addListener(function(tab)
var m_Url = tab.url;
console.log("m_Url: " + m_Url);
);
javascript
In my extension/addon background script I'm having issues trying to a new tab's url, it keeps coming back with 'about:blank', which is fair enough if it hasn't loaded properly yet.
My question is how do you get the url of a newly created tab as soon as it is ready?
browser.tabs.onCreated.addListener(function(tab)
var m_Url = tab.url;
console.log("m_Url: " + m_Url);
);
javascript
javascript
asked Mar 7 at 0:47
HankHank
1,19421959
1,19421959
2
Does it work better to useonUpdatedand look forchangeInfo.urlchanges?
– Mattias Wadman
Mar 7 at 0:53
1
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17
add a comment |
2
Does it work better to useonUpdatedand look forchangeInfo.urlchanges?
– Mattias Wadman
Mar 7 at 0:53
1
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17
2
2
Does it work better to use
onUpdated and look for changeInfo.url changes?– Mattias Wadman
Mar 7 at 0:53
Does it work better to use
onUpdated and look for changeInfo.url changes?– Mattias Wadman
Mar 7 at 0:53
1
1
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17
add a comment |
1 Answer
1
active
oldest
votes
Use onUpdated instead.
Check the doc https://developer.chrome.com/extensions/tabs#event-onUpdated
Fired when a tab is created. Note that the tab's URL may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set.
So, onUpdated event is the appropriate event in this case.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55034415%2fchrome-extension-how-to-get-newly-created-tab-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use onUpdated instead.
Check the doc https://developer.chrome.com/extensions/tabs#event-onUpdated
Fired when a tab is created. Note that the tab's URL may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set.
So, onUpdated event is the appropriate event in this case.
add a comment |
Use onUpdated instead.
Check the doc https://developer.chrome.com/extensions/tabs#event-onUpdated
Fired when a tab is created. Note that the tab's URL may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set.
So, onUpdated event is the appropriate event in this case.
add a comment |
Use onUpdated instead.
Check the doc https://developer.chrome.com/extensions/tabs#event-onUpdated
Fired when a tab is created. Note that the tab's URL may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set.
So, onUpdated event is the appropriate event in this case.
Use onUpdated instead.
Check the doc https://developer.chrome.com/extensions/tabs#event-onUpdated
Fired when a tab is created. Note that the tab's URL may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set.
So, onUpdated event is the appropriate event in this case.
answered Mar 7 at 4:04
balduranbalduran
1205
1205
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55034415%2fchrome-extension-how-to-get-newly-created-tab-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Does it work better to use
onUpdatedand look forchangeInfo.urlchanges?– Mattias Wadman
Mar 7 at 0:53
1
Use onUpdated inside onCreated.
– wOxxOm
Mar 7 at 4:17