本文介绍了Chrome扩展程序WebNavigation API getFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我找到了一个Chrome扩展程序WebNavigation API,但我不知道如何使用它.有人可以给我一个简单的例子吗?

I found a chrome extension WebNavigation API, but I don't know how to use it. Could someone give me a simple example?

API:

chrome.webNavigation.getFrame(object details, function callback)

如果我想在页面中获取iframe id和iframe的scr,我可以使用此API吗?

If I want to get iframe id and iframe's scr in a page, can I use this API ??

推荐答案

作为文档状态,需要传递tabId,processId,frameId ...

As the docs state, one needs to pass tabId, processId, frameId...

为了获得这些值,需要监听.onCompleted():

in order to get these values, one needs to listen for .onCompleted():

chrome.webNavigation.onCompleted.addListener(function(e){

    chrome.webNavigation.getFrame(
        {tabId: e.tabId, processId: e.processId, frameId: e.frameId},
        function(details){
            console.dir(details);
        }
    );

});

.getFrame()之前的事件属性已经为人所知

The event's properties are already known before the .getFrame()

这篇关于Chrome扩展程序WebNavigation API getFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:08