What Is an Offline Package
An offline package bundles in-page static resources, including HTML, JavaScript, and CSS, into a single compressed archive. When a user opens the app, the Client-side downloads the offline package locally, then loads it directly from the local storage through the DingTalk Client-side. This minimizes the impact of the network environment on DingTalk H5 Micro apps.Integration Limits
- Available only on mobile, and the Client-side version must be 6.5.20 or later.
- The total size of the uploaded offline resources must not exceed 10 MB.
Integration Steps
Step 1: Enable the Micro App Offline Package Feature
- Sign in to the DingTalk Developer Console.
- Select the app for which you want to enable the offline package.
- In the navigation bar, click Version Management and Release. On the Version Management and Release page, click the Offline Package Management button, then click Confirm.
Step 2: Package the Offline Package
-
In your project, install dingtalk-h5package-opensdk via npm.
-
In your project, create the offline package configuration file
localresource.json. Here is an example: -
Run the packaging command in your project to output a resource file named
${offlinePackageId}.ziplocally.
Step 3: Upload the Offline Package
On the Version Management and Release page, click Please upload the H5 resource package (.zip, .tar, .tar.gz), select the archive resource from Step 2, and wait for the offline package to be parsed.Step 4: Release the Offline Package
Select the target version of the offline package, click the Release button, and then click Confirm Release.How to Use
In the query parameters of the business URL, append thedd_mini_app_id field. Get its value from the Offline Package ID on the Offline Package Management page.
Example:
Normal URL: https://www.example.com/myapp/index.html
Offline package URL: https://www.example.com/myapp/index.html?dd_mini_app_id=500000000xxxxx
Debugging Tools
DingTalk provides a debugging tool for offline packages. Its main features are checking local offline package information on the phone and DevTools for H5 offline package pages. Client-side version requirements to use the debugging tool: Android 6.5.35 or later; iOS 6.5.35 or later. How to use the tool: Scan the following QR Code with the DingTalk Client-side. After scanning the QR Code, you enter the debugging tool home page.H5 Page Diagnosis
How page diagnosis works: When an H5 offline package page opens, the container injects DevTools into the page to monitor how the page runs. Steps:- Click H5 Page Diagnosis.
- Enter the URL of the H5 offline package to enable.
- Click Start Diagnosis to enter the diagnosis page.
Local Offline Package Check
Steps:- Click Local Offline Package Query.
- Enter the
miniAppId, which is the offline package ID. - Click View Offline Package Information.