gpt4 book ai didi

javascript - 如何过滤网络事件中的可用应用程序 FirefoxOS 以避免应用程序调用自身

转载 作者:行者123 更新时间:2023-11-28 08:16:56 25 4
gpt4 key购买 nike

在我的应用程序中,我想定义共享和选择事件。但是,当我在应用程序中调用“pick”事件时,它允许我选择自己的应用程序,这会产生漏洞。我能以某种方式避免这种情况吗?

 "activities": {
"share": {
"href": "./share-activity.html",
"disposition": "window",
"filters": {
"type": ["image/*","image/jpeg","image/png"]
},
"returnValue": true
},
"pick": {
"href": "./pick-activity.html",
"disposition": "inline",
"filters": {
"type": ["image/*","image/jpeg","image/png"]
},
"returnValue": true
}

最佳答案

尝试如下:

"activities": {
"pick": {
"href": "./index.html",
"disposition": "inline",
"filters": {
"type": "image/*",
"appname": "abc"
},
"returnValue": true
}
}

然后在调用选择事件的代码中,您可以通过调用以下命令来避免应用程序:

var pick = new MozActivity({
name: "pick",
data: {
type: "image/*",
appname: "xyz"

 }
});

添加应用程序名称:“abc”或删除应用程序名称字段将在列表中显示您的应用程序。示例代码:github.com/JasonWeathersby/TestActivity

关于javascript - 如何过滤网络事件中的可用应用程序 FirefoxOS 以避免应用程序调用自身,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23480199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com