Skip to content

iCab Mobile

iCab Mobile 是一款专为 iPhone、iPad 和 Apple Watch 设计的网页浏览器。Protocol Launcher 允许您生成深度链接以在 iCab Mobile 中打开 URL、添加书签和搜索。

使用方式

有两种使用此库的方式:

  • 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
  • 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。

生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

打开浏览器

On-Demand
ts
import { open } from 'protocol-launcher/icab-mobile'

const url = open()

打开 URL

On-Demand
ts
import { openUrl } from 'protocol-launcher/icab-mobile'

const url = openUrl({
  url: 'https://www.example.com/',
})

添加书签

On-Demand
ts
import { addBookmark } from 'protocol-launcher/icab-mobile'

const url = addBookmark({
  url: 'https://www.example.com/',
  title: 'Example',
})

添加到指定文件夹

On-Demand
ts
import { addBookmark } from 'protocol-launcher/icab-mobile'

const url = addBookmark({
  url: 'https://www.example.com/',
  title: 'Example',
  folder: 'Favorites',
})

搜索

On-Demand
ts
import { search } from 'protocol-launcher/icab-mobile'

const url = search({
  query: 'hello world',
})