Writing chrome extension

Is there a section of this site for questions about writing chrome extensions?
Basically I’d like to handle clicks on bookmarks:
If certain pages are being shown in the active tab, show the bookmark in a new tab
otherwise show the bookmark in the current tab replacing what is there.

The idea is to keep from having to Right-click and chose New Tab when I want to preserve the current page.

Thanks,
Norm

Since the extensions are written in JavaScript the JavaScript forum is probably the one where you’d get the most help.

1 Like

Thanks. I asked there first and someone suggested I come here.

Maybe this article will be of some help?

Yes, that site is about extensions but it doesn’t address the type of extension I want to write.

It does tell you what files you need in order to start building the extension.

So the thing to do next is to create the files and put in the content you think you need in each and see what happens. If it doesn’t work then you can post the code here and we can try to help you figure out what is wrong with it.

Thanks for the response. That’s the problem. I have no idea how to add a listener that will be called when a bookmark is clicked on.

I have several extensions I’ve downloaded and made small changes to for experimenting. So far so goo with them.
Norm

Did the API documenattion not help any?

Not really. It doesn’t say anything about adding listeners or responding to clicks.

One thing I am having problems with is syntax errors in my .js files. Does the Chrome browser have a place it shows syntax errors? For example I had mismatched "s - one " and one '. In another I had a : instead of a ;

As best as I know, the dev tools show some syntax errors such as non-paired parentheses, braces and brackets. But for misspelled variables it shows “undefined” errors

I don’t see any reference to my extension .js files in the dev tools frame. The only ,js files I see are those loaded as part of the current page being displayed. I can see the background .js files in the Extension page’s Inspect views: background page view.

Are you using “use strict”?

no. I’ll try that and see what happens.

I added: “use strict”; at the front of a .js file (after a // comment) and changed a " to a ’
Loaded the extension and it didn’t work and there was no error messages I could see.

Hmm odd. adding
"use strict";
AFAIK should send error messages to the console.

Thanks for the ideas. I’m going to be gone for a week. When I get back I’ll try some more.
Norm

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.