> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/jiao-hu-xing/external-links.md).

# 外部链接

链接到其他场景或外部网站

你可以从你的场景添加链接到其他内容，既可以链接到其他场景，也可以链接到外部网站。

## 在 Creator Hub 中使用场景编辑器

添加外部链接或传送的最简单方法是使用场景编辑器。使用 **传送** [智能物品](/creator/content-creator-zh/chang-jing-bian-ji-qi/jiao-hu-xing/smart-items.md) 可在 Genesis City 中添加传送到另一个场景，或使用任何 **社交链接** 智能物品来添加外部站点的链接。

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-be65d3e84db80b872ee31e90d17c016a7b520fbc%2Fsocial-links.png?alt=media)

## 传送

要将玩家传送到另一个场景，请调用以下函数，并指定你希望玩家传送到的坐标。

```ts
import { teleportTo } from "~system/RestrictedActions"

(...)

teleportTo({ worldCoordinates: { x: -51, y: 1 } })
```

玩家在被传送前会看到一个确认界面，该界面会显示来自目标场景的 `scene.json 文件`，包括场景 `名称`, `描述` 和 `navmapThumbnail`。见 [场景元数据](/creator/content-creator-zh/chang-jing-sdk7/xiang-mu-lei-xing/scene-metadata.md) ，了解如何设置这些数据。

请记住，传送会把你带到指定坐标的场景，但不一定是完全相同的坐标。这意味着，当前往一个包含多个地块的场景时，玩家可能不会在指定的相同坐标降落，而是会进入由场景创建者指定的某个出生点。

要将玩家移动到当前场景内的另一组坐标，请使用 `movePlayerTo()` 函数。参见 [移动玩家](/creator/content-creator-zh/chang-jing-sdk7/jiao-hu-xing/player-avatar.md#move-player).

## 传送到 WORLD

要把玩家发送到一个未发布在开放世界 Genesis City 地图中的场景，而是发送到一个独立的 [Decentraland WORLD](/creator/content-creator-zh/chang-jing-sdk7/fa-bu/publishing-options.md#decentraland-worlds)，请使用函数 `changeRealm()`.

```ts
import { changeRealm } from "~system/RestrictedActions"

(...)

changeRealm({realm: 'mannakia.dcl.eth'})
```

玩家在被传送前会看到一个确认界面，该界面会显示来自目标场景的 `scene.json 文件`，包括场景 `名称`, `描述` 和 `navmapThumbnail`。见 [场景元数据](/creator/content-creator-zh/chang-jing-sdk7/xiang-mu-lei-xing/scene-metadata.md) ，了解如何设置这些数据。

无论玩家当前在地图上的坐标如何，都会在该世界中该场景的某个出生点生成。

要将玩家从一个世界送回 Genesis City，请使用 `changeRealm` 设置 `realm` 字段设置为 *'<https://realm-provider-ea.decentraland.org/main>'*.

## 外部链接

要添加指向外部网站的链接，请使用 `openExternalUrl()` 命令。

```ts
import { openExternalUrl } from '~system/RestrictedActions'

openExternalUrl({ url: 'google.com' })
```

为防止有人滥用此功能向玩家发送垃圾内容，只能通过 `openExternalUrl` 在实体上的显式点击或按钮事件中调用。不能因为计时器、碰撞区域或全局点击事件而调用此函数。请参见 [按钮事件](/creator/content-creator-zh/chang-jing-sdk7/jiao-hu-xing/an-niu-shi-jian/click-events.md) ，了解如何执行此操作。

当 `openExternalUrl` 被调用时，玩家会看到一个确认界面，其中会告知他们该链接将把他们带到哪里，并可在此接受或拒绝访问该链接。

该链接会在新标签页中打开，同时保留 Decentraland 中的原始标签页。

如果玩家勾选了 *信任此域名* 复选框，只要链接来自同一场景且指向同一域名，他们在本次会话中就不会再次被提示。

## 复制到剪贴板

要将字符串复制到玩家的剪贴板，请使用 `copyToClipboard()`。之后，当玩家在 *粘贴* 到 Decentraland 聊天中或他们设备上的任何其他应用程序中时，他们粘贴的将是你的字符串。

```ts
import { copyToClipboard } from "~system/RestrictedActions"

copyToClipboard( { text: 'My text to copy' } )
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/jiao-hu-xing/external-links.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
