> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# shouldRedirectUrl

APISummary
`LynxEngine` 通过内部调用此方法来重定向图片路径，要求返回结果为 `String` 类型。

## 语法

### Android

```java
public abstract String shouldRedirectUrl(LynxResourceRequest request);
```

#### 参数说明

- `request`: 资源请求。
- `callback`: 目标 URL。

:::note

- 此方法必须实现。

:::

### iOS

```objc
- (NSString *_Nonnull)shouldRedirectUrl:(LynxResourceRequest *_Nonnull)request;
```

#### 参数说明

- `request`: 资源请求。
- `callback`: 目标 URL。

:::note

- 此方法必须实现。

:::

### Harmony

```typescript
abstract shouldRedirectUrl(request: LynxResourceRequest): string;
```

#### 参数说明

- `request`: 需要重定向的请求。

#### 返回值

- 目标 URL。

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.lynx-media-resource-fetcher.should-redirect-url`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-media-resource-fetcher/should-redirect-url.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| should-redirect-url | Yes (2.8) | Yes (3.4) | Yes (2.8) | No | No | No |

**`should-redirect-url`**

LynxEngine redirects the image path by calling this method internally, and the return result is required to be of String type.

**Specifications:**

