WebView.InvokeScriptAsync(String, IIterable<String>) 메서드

정의

특정 인수를 사용하여 현재 로드된 HTML에서 지정된 스크립트 함수를 비동기 작업으로 실행합니다.

public:
 virtual IAsyncOperation<Platform::String ^> ^ InvokeScriptAsync(Platform::String ^ scriptName, IIterable<Platform::String ^> ^ arguments) = InvokeScriptAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<winrt::hstring> InvokeScriptAsync(winrt::hstring const& scriptName, IIterable<winrt::hstring> const& arguments);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<string> InvokeScriptAsync(string scriptName, IEnumerable<string> arguments);
function invokeScriptAsync(scriptName, arguments)
Public Function InvokeScriptAsync (scriptName As String, arguments As IEnumerable(Of String)) As IAsyncOperation(Of String)

매개 변수

scriptName
String

Platform::String

winrt::hstring

호출할 스크립트 함수의 이름입니다.

arguments

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

인수를 스크립트 함수로 패키지하는 문자열 배열입니다.

반환

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

성공적으로 완료될 때 스크립트 호출의 문자열 결과(또는 스크립트 결과가 문자열이 아닌 경우 빈 문자열)를 검색할 수 있는 비동기 작업 개체입니다.

특성

설명

악성 코드가 앱을 악용하지 않도록 하려면 이 메서드를 호출하여 신뢰할 수 있는 스크립트만 호출해야 합니다.

호출된 스크립트는 문자열 값만 반환할 수 있습니다. 반환 값이 문자열이 아니면 빈 문자열이 반환됩니다. 예를 들어 은 WebView.InvokeScriptAsync("eval", "1==1") 를 사용하지 toStringWebView.InvokeScriptAsync("eval", "(1==1).toString()")않는 한 이 아닌 true빈 문자열을 반환합니다.

스크립트를 실행하는 동안 앱이 응답하지 않는 것처럼 보일 수도 있습니다. LongRunningScriptDetected 이벤트를 처리하여 장기 실행 스크립트를 중단합니다.

적용 대상