Domanda

I would like to know if there is a way to specify for a page action to be shown only on some sites through crossrider and if so how to use it.

I have tried using "appAPI.pageAction.setPages" but the icon is shown on every page and the popup is not loaded unless I use appAPI.pageAction.setPopup.

If you want to see the current state of the extension the id is 56885. I am currently leaving it specified from what I understand to only show on the cross rider site and show the example text as popup but that's not working.

È stato utile?

Soluzione

All you need to use is appAPI.pageAction.setPages.setPages setting the icon and page filter in the options passed to the method. In your extension, I can see that you are using appAPI.pageAction.setResourceIcon which has the effect of setting the icon on every page and hence your issue.

To achieve your goal, simply use something like the following code in your extension.js file:

appAPI.ready(function($) {
    appAPI.pageAction.setPages({
        pages: ["*.google.com/*", /^http\:\/\/twitter\.com/],
        iconResourcePath:'icons/icon.jpg',
        html: '<html><head></head><body>Hello World!</body></html>',
        height: 100,
        width: 300
    });
});

[Disclosure: I am a Crossrider employee]

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top