# WebView에서 사용

## 자바스크립트 인터페이스 설정

앱 WebView에서 사용자 정보를 수신받기 위해 자바스크립트 인터페이스 설정을 합니다.

{% tabs %}
{% tab title="iOS" %}

```swift
let fingerWeb = fingerWebInterface()
fingerWeb.initInterface(with: WebView, jsLoad: true)
```

{% endtab %}

{% tab title="Android" %}

```kotlin
// WebView 자바스크립트 사용 설정
WebView.settings.javaScriptEnabled = true
// 자바스크립트 인터페이스 추가
WebView.addJavascriptInterface(FingerPushWebInterface(Context, WebView), FingerPushWebInterface.NAME)
// WebView Client 연결
WebView.webViewClient = FingerWebViewClient(Context)
```

{% endtab %}
{% endtabs %}

## 웹에서 앱으로 사용자 정보 전달

제공하는 자바스크립트 함수는 Android 및 Apple 네이티브 코드 모두와 호환되는 방법입니다.

다음 함수를 통해 사용자 정보 데이터를 전달할 수 있습니다.

<details>

<summary>FingerBridge.finger.sendUserSegment(String UserInfo)</summary>

{% code title="예제" %}

```javascript
// 사용자 정보
let userInfo = {
    name : "홍길동",
    gender : 0,
    age : 20,
    ...
};

let strJson = JSON.stringify(userInfo);
// 자바스크립트 인터페이스로 세그먼트 함수 호출
FingerBridge.finger.sendUserSegment(strJson);

```

{% endcode %}

</details>


---

# Agent Instructions: 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:

```
GET https://developers.fingerpush.com/segment/sdk/webview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
