Chrome扩展程序开发:从background_html调用弹出窗口中的方法 [英] Chrome extension development: Call a method in popup from background_html

查看:343
本文介绍了Chrome扩展程序开发:从background_html调用弹出窗口中的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为mf_popup.html的弹出窗口,我的背景页面名为mf_background.html.

I have a popup named mf_popup.html and my background page is named mf_background.html.

启动浏览器时,背景页面会触发(据我所知,我是Chrome开发的新手),我想从背景页面的mf_popup.html页面中调用一个函数.

As I start the browser my background page fires (as is my understanding, I am new to Chrome development), and I would like to call a function in my mf_popup.html page from my background page.

例如:

Start chrome

background page fires

background page calls some function in popup page (which initiates some stuff)

我该如何做?

推荐答案

,如果您将所需的代码放在mf_javascript.js的两个html文件中,并在此行中都包含脚本,则此行:

if you place the needed code in both html-files in mf_javascript.js and includes the script in both with this line:

<script type="text/javascript" src="mf_javascript.js">

这篇关于Chrome扩展程序开发:从background_html调用弹出窗口中的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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