Google plug-in extension method

Source: Internet
Author: User

Chrome.tabs.create (object createProperties , function callback )

Creates a new label. Note: This method can also be used without the need to request manifest tag permissions.

ParameterscreateProperties ObjectwindowId OptionalCreates a target window for a new label. The default is the current window.index OptionalThe position of the label in the window. The value is between 0 and the number of labels.url OptionalThe initial page of the label navigation. The complete URL must contain a prefix (such as ' http://www.google.com ', which cannot be written as ' www.google.com '). The relative URL is relative to the page where the extension is located, and the default value is the New tab page.selected OptionalWhether the label is a checked label. The default is true.pinned OptionalWhether the label is fixed. The default value is False.callback OptionalCallback function

The callback parameters should be defined as follows:

{...};
tab TabThe details of the created label, including the ID of the new label. Getchrome.tabs.get (integer tabId , function callback )

Gets the detail information for the specified label.

ParameterstabId integercallback function
callback function

The callback parameters should be defined as follows:

{...};
tab TabGetAllInWindowchrome.tabs.getAllInWindow (integer windowId , function callback )

Gets details about all the labels in the specified window.

ParameterswindowId OptionalThe default is the current window.callback function
callback function

The T callback parameter should be defined as follows:

{...};
tabs array of TabGetCurrentchrome.tabs.getCurrent (function callback )

Gets the label of the build script call. This function does not apply to cases where the script is called by non-tagged content. (for example, a background page or a pop-up view).

Parameterscallback function
callback function

The callback parameters should be defined as follows:

{...};
tab OptionalGetSelectedchrome.tabs.getSelected (integer windowId , function callback )

Gets the specified label for a specific window.

ParameterswindowId OptionalThe default is the current window.callback function
callback function

The callback parameters should be defined as follows:

{...};
tab TabInsertCSSchrome.tabs.insertCSS (integer tabId , Object details , function callback )

Inject CSS into the page. To learn more, see the Programmatic injection section of the content scripting document.

ParameterstabId OptionalThe tag ID of the CSS to inject, and the label that the current window is selected by default.details ObjectTo inject the content of the CSS, you can choose either code or file, but you cannot select both.code OptionalThe CSS code to inject.file OptionalThe CSS file to inject.allFrames OptionalTrue, the CSS is injected into all frame. The default is false, which only injects CSS to the top-level frame.callback OptionalWhen all the CSS is injected, the callback is called.
callback function

The callback parameters should be defined as follows:

{...};
Movechrome.tabs.move (integer tabId , Object moveProperties , function callback )

Move the label to a specific location within the window, or move to a new window. Note that you can only cut between normal windows (Window.type = = = "Normal").

ParameterstabId integermoveProperties ObjectwindowId OptionalThe default is the window where the label is located.index integerThe location of the target window to move to. The assignment must be between 0 and the number of labels in the target window.callback Optional
callback function

The callback parameters should be defined as follows:

{...};
tab TabThe tag details that were moved. Removechrome.tabs.remove (integer tabId , function callback )

Close the label.

ParameterstabId integercallback Optional
callback function

The callback parameters should be defined as follows:

{...};
SendRequestchrome.tabs.sendRequest (integer tabId , request any , function responseCallback )

A request is sent to a specific tagged content script, and a callback can be attached when the response is returned. After all content script responds to the request, the Chrome.extension.onRequest event is triggered for the current extension.

ParameterstabId integerrequest anyresponseCallback OptionalParametersresponse anyThe JSON object for the response. If an error occurs, the callback will not have parameters. and will produce an error in Chrome.extension.lastError.
callback function

The callback parameters should be defined as follows:

{...};
response anyThe JSON object for the response. If an error occurs, the callback will not have parameters. and will produce an error in Chrome.extension.lastError. Updatechrome.tabs.update (integer tabId , Object updateProperties , function callback )

Modifies the properties of a label. Properties that are not specified in Updateproperties are not modified. Note: This method still applies even if the ' tabs ' permission is not requested for manifest.

ParameterstabId integerupdateProperties Objecturl OptionalThe URL to let the tag browse.selected OptionalWhether the label should be selected.pinned OptionalWhether the label should be pinned.callback Optional
callback function

The callback parameters should be defined as follows:

{...};
tab TabThe label details are updated. Eventsonattachedchrome.tabs.onAttached. AddListener (function (integer tabId, object attachinfo) {...});

This event is triggered when the label is attached to the window. For example, this event occurs when the label is moved before the window.

ParameterstabId integerattachInfo ObjectnewWindowId integernewPosition integeroncreatedchrome.tabs.onCreated. AddListener (Function (Tab tab) {...});

This event is triggered when a label is created. Note that when an event is triggered, the URL of the tag may not be set, but when the URL is set, it can be answered via the OnUpdated event.

Parameterstab TabThe details of the label creation. Ondetachedchrome.tabs.onDetached. AddListener (function (integer tabId, object detachinfo) {...});

This event is triggered when the label is detached from the window, such as when the label moves between windows.

ParameterstabId integerdetachInfo ObjectoldWindowId integeroldPosition integerOnmovedchrome.tabs.onMoved. AddListener (function (integer tabId, object moveinfo) {...});

This event is triggered when the label moves within the window. Only one move event is triggered, which gives the user the label to move directly. Other tags that respond to a move event do not trigger a move event. See ondetached. View details.

ParameterstabId integermoveInfo ObjectwindowId integerfromIndex integertoIndex integerOnremovedchrome.tabs.onRemoved. AddListener (function (integer tabId, object removeinfo) {...});

Triggered when the label is closed.

ParameterstabId integerremoveInfo ObjectisWindowClosing BooleanThis parameter is true when the window is closed and the label is closed. OnSelectionChangedchrome.tabs.onSelectionChanged. AddListener (function (integer tabId, object selectinfo) {...});

This event triggers when the tab selected by the window changes

ParameterstabId integerThe ID of the selected tag.selectInfo ObjectwindowId integerThe window ID in which the label changed. onUpdatedchrome.tabs.onUpdated. AddListener (function (integer tabId, Object changeinfo, Tab tab) {...});

This event is triggered when the label is updated.

ParameterstabId integerchangeInfo ObjectLists the status when the label is updated.status OptionalThe status of the label. Can think LoadingOr Complete。url OptionalThe URL of the label that experienced the change.pinned OptionalThe new state in which the label is locked.tab TabThe status of the updated label. Typestab Objectid integerThe label ID. The tag ID is unique within a browser session.index integerThe zero-based label index within the window.windowId integerThe window ID of the window where the label is located.selected BooleanWhether the label is selected.pinned BooleanWhether the label is locked.url stringThe URL that the label displays.title OptionalThe title of the label. When the label is loaded, the caption may not be successfully fetched.favIconUrl OptionalThe URL of the label favorites icon. When the label is loaded, the icon may not be successfully fetched.status Optionalcan be set to LoadingOr Complete。incognito Booleancan be set to LoadingOr Complete. --------------------from 360 Fast browser open platform

Google plug-in extension method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.