1e41f4b71Sopenharmony_ci# Version Compatibility Adaptation
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciAs you incorporate new features into service widgets of your applications, take measures to avoid abnormal display of these features on earlier versions. You can specify the minimum SDK version in the service widget project so that service widgets incorporating new features will not be installed on incompatible systems. You can also follow the instructions in this section to implement forward compatibility during your service widget development.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciConfigure forward compatibility in the JSON configuration file. Specifically, set the **apiVersion** attribute, which is at the same level as the **data** and **actions** fields in the service widget configuration file. The content defined in **apiVersion** overwrites the original content in **data** based on the current version information.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciExample:
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciAssume that the JS service widget framework supports WebP image sources since API version 9. Then you can implement forward compatibility as follows:
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci```html
14e41f4b71Sopenharmony_ci<!-- xxx.hml -->
15e41f4b71Sopenharmony_ci<div>
16e41f4b71Sopenharmony_ci    <image src="{{imageSrc}}" style="width: 100px;height: 100px;"></image>
17e41f4b71Sopenharmony_ci</div>
18e41f4b71Sopenharmony_ci```
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ciJSON configuration file:
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci```json
23e41f4b71Sopenharmony_ci{
24e41f4b71Sopenharmony_ci  "data": {
25e41f4b71Sopenharmony_ci    "imageSrc": "defaultSrc.png"
26e41f4b71Sopenharmony_ci  },
27e41f4b71Sopenharmony_ci  "apiVersion": {
28e41f4b71Sopenharmony_ci    "9": {
29e41f4b71Sopenharmony_ci      "imageSrc": "newSrc.webp"
30e41f4b71Sopenharmony_ci    }
31e41f4b71Sopenharmony_ci  }
32e41f4b71Sopenharmony_ci}
33e41f4b71Sopenharmony_ci```
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ciThe JS service widget development framework selects the most appropriate data based on the application configuration and the current API version.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciIf the API version is 8 or earlier, the value of **imageSrc** is **defaultSrc.png**.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciIf the API version is 9, the value of **imageSrc** is **newSrc.webp**.
40