<tfoot id='iACkJ'></tfoot>
    <bdo id='iACkJ'></bdo><ul id='iACkJ'></ul>
  • <small id='iACkJ'></small><noframes id='iACkJ'>

      <legend id='iACkJ'><style id='iACkJ'><dir id='iACkJ'><q id='iACkJ'></q></dir></style></legend>

    1. <i id='iACkJ'><tr id='iACkJ'><dt id='iACkJ'><q id='iACkJ'><span id='iACkJ'><b id='iACkJ'><form id='iACkJ'><ins id='iACkJ'></ins><ul id='iACkJ'></ul><sub id='iACkJ'></sub></form><legend id='iACkJ'></legend><bdo id='iACkJ'><pre id='iACkJ'><center id='iACkJ'></center></pre></bdo></b><th id='iACkJ'></th></span></q></dt></tr></i><div id='iACkJ'><tfoot id='iACkJ'></tfoot><dl id='iACkJ'><fieldset id='iACkJ'></fieldset></dl></div>

      1. UIWebView baseURL 和绝对路径

        时间:2023-09-04

        <i id='RTDaP'><tr id='RTDaP'><dt id='RTDaP'><q id='RTDaP'><span id='RTDaP'><b id='RTDaP'><form id='RTDaP'><ins id='RTDaP'></ins><ul id='RTDaP'></ul><sub id='RTDaP'></sub></form><legend id='RTDaP'></legend><bdo id='RTDaP'><pre id='RTDaP'><center id='RTDaP'></center></pre></bdo></b><th id='RTDaP'></th></span></q></dt></tr></i><div id='RTDaP'><tfoot id='RTDaP'></tfoot><dl id='RTDaP'><fieldset id='RTDaP'></fieldset></dl></div>

        <small id='RTDaP'></small><noframes id='RTDaP'>

        <tfoot id='RTDaP'></tfoot>

          <tbody id='RTDaP'></tbody>

          <legend id='RTDaP'><style id='RTDaP'><dir id='RTDaP'><q id='RTDaP'></q></dir></style></legend>

              • <bdo id='RTDaP'></bdo><ul id='RTDaP'></ul>
                1. 本文介绍了UIWebView baseURL 和绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个这样构造的 HTML 页面:

                  I have an HTML page that is constructed like this:

                  <html>
                    <head>
                      <link rel="stylesheet" href="/style.css" />
                    </head>
                    <body>
                  
                    </body>
                  </html>
                  

                  它存储在我的文档目录中:

                  It is stored in my documents directory:

                  /Users/username/Library/Application Support/iPhone Simulator/5.1/Applications/12345-ID/Documents/mysite/index.html
                  

                  我也将 style.css 保存在文档目录中:

                  I have also stored the style.css in the documents directory:

                  /Users/username/Library/Application Support/iPhone Simulator/5.1/Applications/12345-ID/Documents/mysite/style.css
                  

                  但是现在,当我尝试使用以下方法将 html 加载到我的 webview 中时:

                  But now, when I try to load the html into my webview using this:

                  NSURL *test = [NSURL URLWithString:@"file:///Users/username/Library/Application Support/iPhone%20Simulator/5.1/Applications/12345-ID/Documents/mysite/"]
                  [myWebView loadHTMLString:<the content retrieved from index.html> baseURL:test];
                  

                  css 没有加载,当我使用 NSURLProtocol 拦截对样式表的请求时,我可以看到请求是错误的.它正在尝试请求:

                  The css is not loaded, when I intercept the request to the stylesheet with a NSURLProtocol I can see the request is wrong. It is trying to request:

                  file:///style.css

                  file:///style.css

                  而不是完整的 baseURL.现在我可以通过删除html文件中/style.css前面的/来解决这个问题.但是有没有一种简单的方法可以在不修改 html 的情况下在本机代码中解决这个问题?

                  instead of the full baseURL. Now I can solve this by removing the / in front of /style.css in the html file. But is there an easy way to resolve this in native code without modifying the html?

                  推荐答案

                  删除斜线是唯一的解决方案

                  Removing the slash was the only solution

                  这篇关于UIWebView baseURL 和绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 下一篇:jqgrid 在更改另一个单元格时更改可编辑单元格的值(相关列)

                  相关文章

                2. <tfoot id='oYr5l'></tfoot>

                    <bdo id='oYr5l'></bdo><ul id='oYr5l'></ul>
                3. <legend id='oYr5l'><style id='oYr5l'><dir id='oYr5l'><q id='oYr5l'></q></dir></style></legend>
                  <i id='oYr5l'><tr id='oYr5l'><dt id='oYr5l'><q id='oYr5l'><span id='oYr5l'><b id='oYr5l'><form id='oYr5l'><ins id='oYr5l'></ins><ul id='oYr5l'></ul><sub id='oYr5l'></sub></form><legend id='oYr5l'></legend><bdo id='oYr5l'><pre id='oYr5l'><center id='oYr5l'></center></pre></bdo></b><th id='oYr5l'></th></span></q></dt></tr></i><div id='oYr5l'><tfoot id='oYr5l'></tfoot><dl id='oYr5l'><fieldset id='oYr5l'></fieldset></dl></div>

                    1. <small id='oYr5l'></small><noframes id='oYr5l'>