在 WebView 中单击链接时加载本地 HTML 文件 [英] load local HTML file when link is clicked in WebView

查看:23
本文介绍了在 WebView 中单击链接时加载本地 HTML 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个加载本地 HTML 文件的 WebView,如下所示:

I have a WebView that loads a local HTML file like this:

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test1" ofType:@"html"]isDirectory:NO]]];

我想要的是单击 test1 本地 HTML 文件中的链接,然后让 webView 加载 test2 本地 HTML 文件.

What I want is to click a link in the test1 local HTML file and then for the webView to load the test2 local HTML file.

我该怎么做?

推荐答案

就像在普通网页中一样.让测试 1 中的链接指向测试 2.

Like in a regular webpage. Let the link in test 1 point to test2.

这篇关于在 WebView 中单击链接时加载本地 HTML 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆