开发者

how to capture screen when user click on link - chrome extension

开发者 https://www.devze.com 2023-02-28 07:57 出处:网络
I am novice t开发者_JAVA百科o chrome extensions When a user clicks on the link in my extension,

I am novice t开发者_JAVA百科o chrome extensions When a user clicks on the link in my extension,

1) I want capture the selected tab screen and

2) Open up a new email with the captured screen shot as attachment

i have tried by calling "show1()" function to capture the screen when user clicks on the link but no result/no alert

function show1(){
    chrome.tabs.captureVisibleTab(null,{"format":"png"}, function(imgUrl) {
        alert(imgUrl);                                            
    });    
  }

Thanks in advance , Raghav


Try changing "format" to just format.

Still, I think you'll run into problems generating a mailto: link because you'd be including the img data, which is a very long string. But you might be able to display the image at least somewhere with '<img src="'+imgUrl+'" />' and have the user Right-click > Save the image so that they can attach it to an email later.

However, this wouldn't be able to be done within a Page Action, nor a Browser Action, because you can't right-click on those. But you could execute a content script to the selected tab and have the image be displayed on the existing page for the user to save.

0

精彩评论

暂无评论...
验证码 换一张
取 消