Search code examples
javascriptcrossrider

ContextMenu.add shows a warning whenever initiated


I'm trying to follow sample for appAPI.contextMenu in Crossrider API http://docs.crossrider.com/#!/api/appAPI.contextMenu-method-add

background.js

appAPI.ready(function() {
    // Adds a command to all context menus that displays the data object
    appAPI.contextMenu.add("key1", "Display data object", function (data) {
        console.log('pageUrl: ' + data.pageUrl + '\n' +
            'linkUrl: ' + data.linkUrl + '\n' +
            'selectedText:' + data.selectedText + '\n' +
            'srcUrl:' + data.srcUrl);
    }, ["all"]);

    // Adds a command to "link" context menus that displays 'Hello World'
    // Note: Since both commands display on links, they are grouped in a sub menu
    appAPI.contextMenu.add("key2", "Hello World", function (data) {
        console.log('Changed onClick to Alert Hello World');
    }, ["link"]);
});

extension.js

appAPI.ready(function($) {
});

the following warn is thrown in console log of background page.

Warning: Parameter context value is not supported. Function-name: appAPI.contextMenu.add

PS, if you are a Crossrider Staff willing to help, a sample can be reproduced by extension id: 62139


Solution

  • The message is a mere warning and does not affect the operation of the extension; hence, it can be safely ignored.

    I took the additional precaution of installing the extension on Chrome and Firefox and the context menu works correctly as defined in your code. If you have a specific issue with the extension not working correctly, please feel free to email support@crossrider.com.

    [Disclaimer: I am a Crossrider employee]