【英文】把Chrome浏览器扩展转换成Safari浏览器扩展
Preface
Converting Chrome browser extensions to Safari browser extensions
This case only applies to situations where the source code package “.crx” of the Chrome browser extension can be obtained
Or as a developer, convert your own Chrome browser extension into a Safari browser extension.
Preparation
- Get the
.crx
source code package of the extension - Prepare Xcode.app on MacOS
Extracting the source code from the crx package
- Change the file extension of the
.crx
file to.zip
, and then extract it using a compression tool to obtain the extension source code
Creating an Xcode project
- Create a new Xcode project
macOS
->Safari Extension App
->Next
- Configure
Product Name
->Next
- Choose the project storage location
- Right-click on the
Resources
directory under theExtension
module->Show in Finder
- Delete all files in the
Resources
directory in Finder, do not close the Finder window, it will be used later
- Delete all files in the
Resources
directory within theExtension
module in Xcode as well
- Copy all the source code of the Chrome browser plugin to the
Resources
directory under theExtension
module (the files in this directory were just deleted, now replace them with the prepared source code files)
- Right-click on the
Resources
directory under theExtension
module->Add Files to ""
- Select all the newly replaced source code files->
Add
- Click the run button in the top left corner and wait for the compilation to finish. After the compilation is completed, the
APP
window will be automatically launched. Click the button in the middle of the windowQuit and Open Safari Settings
to automatically jump to the Safari settings window
- Check the newly created Safari browser extension in the Safari settings window to enable it
- If you encounter signing issues that prevent it from being used, you can go to the Safari menu bar and select
Develop
-> CheckAllow Unsigned Extensions
(requires login password authentication for the current account)