Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我可以为桌面和手机制作一个简单的浏览器插件吗?_Android_Google Chrome Extension_Firefox Addon_Desktop - Fatal编程技术网

Android 我可以为桌面和手机制作一个简单的浏览器插件吗?

Android 我可以为桌面和手机制作一个简单的浏览器插件吗?,android,google-chrome-extension,firefox-addon,desktop,Android,Google Chrome Extension,Firefox Addon,Desktop,我想使用Chrome,但Android版Chrome似乎无法运行扩展?Firefox中的支持似乎不稳定 我只想请求并执行特定域的远程CSS和JS文件。我不需要任何UI或任何东西 不确定我是否应该继续使用Firefox,或者考虑使用嵌入插件的“浏览器”?您可以使用Firefox SDK,可在以下位置获得: 它允许您为这两种平台进行开发。如果您在firefox for android中遇到sdk问题,可以阅读以下内容: 如果不需要UI,则很容易设置:) 关于本文中的评论,我编写了一个脚本,用于设置正

我想使用Chrome,但Android版Chrome似乎无法运行扩展?Firefox中的支持似乎不稳定

我只想请求并执行特定域的远程CSS和JS文件。我不需要任何UI或任何东西


不确定我是否应该继续使用Firefox,或者考虑使用嵌入插件的“浏览器”?

您可以使用Firefox SDK,可在以下位置获得:

它允许您为这两种平台进行开发。如果您在firefox for android中遇到sdk问题,可以阅读以下内容:

如果不需要UI,则很容易设置:)

关于本文中的评论,我编写了一个脚本,用于设置正在开发的扩展:

# Run this script from your project base dir.
#1 - Complete the following vars:
#ANDROID_APP_ID=org.mozilla.fennec;
ANDROID_APP_ID=org.mozilla.firefox_beta; 
#ANDROID_APP_ID=org.mozilla.firefox;
APP_NAME="YourExtensionName";
OUTPUT_DIR=$HOME/Bureau;
FILES="./";
EXCLUDE="-xr!./.git";
CLEAN_APP_DATA=false;

#2 - This will clear all your app cache
if [ "$CLEAN_APP_DATA" == "true" ]; then
    adb shell pm clear $ANDROID_APP_ID
fi

#3 - This will create the XPI file
7z a -r $OUTPUT_DIR/$APP_NAME.xpi $FILES $EXCLUDE;

#4 - This will copy the XPI to the phone SD card. Don't worry if you don't have SD card, it will be copied to a directory called /sdcard
adb push $OUTPUT_DIR/$APP_NAME.xpi /sdcard/$APP_NAME.xpi;

#5 - This will start the Firefox App with the XPI to install
adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -d file:///mnt/sdcard/$APP_NAME.xpi -n $ANDROID_APP_ID/.App;

#6 - Redirect tcp to watch via console
#adb forward tcp:6000 tcp:6000; #For Firefox for Android 34 and earlier
adb forward tcp:6000 localfilesystem:/data/data/$ANDROID_APP_ID/firefox-debugger-socket #For Firefox for Android 35 and later

#7 - This will wait to you to test your addon and press any key to close Firefox. 
echo ""; read -p "Press 'r' to restart or any other key to close the browser..." pressedKey;

if [ "$pressedKey" == "r" ]; then 
    adb shell am force-stop $ANDROID_APP_ID;

    #8 - This will remove the XPI from the filesystem (but it's still copied on your Firefox)
    adb shell rm /sdcard/$APP_NAME.xpi
    rm $OUTPUT_DIR/$APP_NAME.xpi;
    echo "Firefox has been forced to stop. Restarting...";
    adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -n $ANDROID_APP_ID/.App;

    echo ""; read -p "Test your addon on mobile. Press any key to close app..."; 
fi

adb shell am force-stop $ANDROID_APP_ID;
adb shell rm /sdcard/$APP_NAME.xpi
rm $OUTPUT_DIR/$APP_NAME.xpi;
exit 0;

是的,为firefox制作二合一很容易。这是一个例子:这里是addon sdk移动文档:特别是没有UI的情况下,它与page worker模块完全相同,我认为这是关于如何跨平台实现的另一个很好的资源:谢谢:)很棒的解决方案。关于如何在开发过程中调试/测试插件的任何提示?是否只需要通过usb连接android?如何从我的桌面文件夹推送/安装到android以进行快速测试?@Noitidart的评论对于此响应来说太小了,所以我会将其添加到answer@gal007伟大的我很期待,我将开始大量开发一些FxOS应用程序,这将对我有所帮助。嗨,gal,我编写了所有脚本文件并制作了xpi,但我不知道如何将我的插件从我的桌面安装到我的android上,我该怎么做?我知道了如何安装,而不是adb的漫长过程,我将我的扩展代码推送到github,然后直接从github用这个插件在android上安装:这种方式太麻烦了,他们想让我安装整个android sdk垃圾: