How to get current tab url - Bubble based chrome extension

I built a chrome extension page using bubble, but unable to get current tab url. I created a button with a workflow to run javascript and then used Javascript to Bubble plugin to get the url. But it is not returning anything. I’m a beginner in Javascript. Kindly help me with this!


Hey @jobtracker000,

A couple of options you can try (I have no knowledge of building Chrome extensions btw):

1) Bubble’s This url:

image

2) Javavascript, ‘window.location.href’

3) Did you Google/Stackoverflow it?

For example: How to fetch URL of current Tab in my chrome extension using javascript - Stack Overflow

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://stackoverflow.com/questions/18436245/how-to-fetch-url-of-current-tab-in-my-chrome-extention-using-javascript#comment-39437494)]

https://developer.chrome.com/extensions/activeTab

Code:

```
chrome.tabs.query({currentWindow: true, active: true}, function(tabs){
    console.log(tabs[0].url);
});
```
1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.