Home > SYS_Window > urlPushState
SYS_Window.urlPushState() method
Append new URL history stack information
Signature
typescript
function urlPushState(url: string): void;1
Parameters
Parameter | Type | Description |
|---|---|---|
url | string | URL |
Returns
void
Example
javascript
// 1. 备份当前完整地址
const originalHref = location.href;
// 2. 追加一条带示例锚点的新历史记录
eda.sys_Window.urlPushState(`${location.href.split('#')[0]}#嘉立创示例_新状态`);
// 3. 验证地址栏已更新为新的锚点
console.log('追加后的锚点:', decodeURIComponent(eda.sys_Window.getUrlAnchor()));
// 4. 还原地址栏
eda.sys_Window.urlReplaceState(originalHref);
console.log('地址已还原');1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12