AppML 下载

获取 appml.js、本地部署、版本选择与离线可用性。

Beginner
Key Points把 appml.js 下载到本地项目里引用,是让 AppML 在离线或内网环境可用的唯一办法。

两种引用方式

HTML
<!-- 方式一:CDN(需要外网) -->
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>

<!-- 方式二:本地(推荐用于正式项目) -->
<script src="js/appml.js"></script>

The CDN is convenient but depends on the internet and on their version control: an upgrade or shutdown breaks your page. Production projects should always host it locally.

本地部署

Bash
# 用 curl 或浏览器另存
curl -o appml.js https://www.w3schools.com/appml/2.0.3/appml.js
Text
my-app/
├── index.html
├── js/
│   └── appml.js
├── models/
│   └── customers.xml
└── data/
    └── customers.json

版本选择

VersionNotes
1.x早期版本,API 与 2.x 不兼容
2.0.x目前文档主要对应的版本
未版本化路径会随上游更新,不要用于生产

A versioned path (/2.0.3/appml.js) is more predictable: upstream releases cannot affect you, at the cost of manual upgrades.

离线验证

HTML
<script src="js/appml.js"></script>
<script>
  window.addEventListener('load', () => {
    if (typeof appml === 'undefined') {
      document.body.insertAdjacentHTML('afterbegin',
        '<p style="color:#c00">AppML 未加载,请检查 js/appml.js 路径</p>');
    }
  });
</script>

A self-check saves a lot of debugging: when AppML fails to load the page is simply blank and the console shows only appml is not defined, easily mistaken for a model error.

AppML is a single script with no npm package, no type definitions and no build step. It suits teaching demos and tiny internal tools, not projects needing a real toolchain.

许可证与来源

AppML is maintained by W3Schools with source and examples published on their site. Check the current licence before commercial use; teaching projects often change terms.

Friends & Partners