从弹出窗口调用后台函数 [英] Call a function in background from popup

查看:26
本文介绍了从弹出窗口调用后台函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从弹出窗口调用后台脚本中的函数?我无法比那个问题更进一步地解释它.这不是我正在尝试做的事情的错误,而是我完全不知道该怎么做的事情.我想让点击弹出页面中的按钮成为可能,该按钮将调用后台页面中定义的函数.

Is there a way to call a function in the background script from the popup? I can't explain it much further than that question. It's not an error I'm having with what I'm trying to do but rather something I completely don't know how to do. I want to make it possible to click a button in the popup page that'll call a function defined in the background page.

推荐答案

试试这个

 var bgPage = chrome.extension.getBackgroundPage();
 var dat =  bgPage.paste(); // Here paste() is a function that returns value.

这篇关于从弹出窗口调用后台函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆