일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 소개팅앱 만들기
- supabase storage feature not enabled for this tenant
- DT_TOOLCHAIN_DIR cannot be used
- Firebase authentication apple login
- supabase edge function deploy error supabaseurl is required
- Stomp user connection event
- Stomp socket connection event
- stable-diffusion-webui local 접속
- supabase edge function deploy error
- stable-diffusion-webui local 네트워크에서 접속
- Firebase authentication apple login 최신
- Spring google SMTP settings
- Firebase authentication android apple login setting
- Supabase edge function
- invite user for supabase project
- 로컬 서버 접속
- no such module '__ObjC'
- supabase storage public url not working
- Supabase edge function insert data
- 주 4일 근무제
- 주 4일 근무제 경험담
- 주 4일 근무제 log
- Spring LocalDateTime response array
- Android apple login identifier
- Android apple login
- Spring boot swagger blank screen
- 소개팅앱 만들기 stomp
- Android apple login 인증서 설정
- Firebase authentication android apple login
- 소개팅앱 만들기 flutter
- Today
- Total
꿀맛코딩
How to control href in iOS WKWebView (iOS WKWebView href 조작 하는법) 본문
How to control href in iOS WKWebView (iOS WKWebView href 조작 하는법)
soycrab 2019. 10. 29. 12:53우리가 WKWebView에서 html의 href를 클릭했을 때
어떻게 조작을 할수 있을까?
방법은 아래와 같다.
두 가지 예제가 있는데,
첫째 Click 한 href의 url 값을 가져와서 사용하는 방법.
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.mainDocumentURL?.absoluteString, url.contains("naver.com") {
//TODO
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
둘째 Click 한 이벤트가 link 인지 구분하는 방법.
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if navigationAction.navigationType == WKNavigationType.linkActivated {
//TODO
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
위의 두 개 코드를 활용해서 손쉬운 조작이 가능하다.