tanorigin
V2EX  ›  iOS

[咨询] 强制改变 UIWebView 加载好的 html 文档中的 outerHtml,会导致在该 UIWebview 中调用文档中 JS 方法出现故障吗?

  •  
  •   tanorigin · Feb 26, 2016 · 2281 views
    This topic created in 3731 days ago, the information mentioned may be changed or developed.
    问题描述: http://stackoverflow.com/questions/35640909/uiwebview-force-to-modify-the-outerhtml-will-make-it-uneditable

    感觉 bug 出现在 webView2 中的 webViewDidFinishLoad 方法中,就是在该方法中调用

    [webView2 stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('content').outerHTML = '%@'",someOuterHtml]];

    就会出现上述问题。
    [该 html 中 body 就只有一个 content 节点,打印出来的 html 是全的]

    这是个什么 bug ,是调用位置出错,还是其他原因呢?
    谢谢您看到了此处。
    1 replies    2016-02-26 11:14:34 +08:00
    tanorigin
        1
    tanorigin  
    OP
       Feb 26, 2016
    已解决 谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2894 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:09 · PVG 20:09 · LAX 05:09 · JFK 08:09
    ♥ Do have faith in what you're doing.