V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tanorigin
V2EX  ›  iOS

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

  •  
  •   tanorigin · Feb 26, 2016 · 2257 views
    This topic created in 3723 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   ·   2931 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:27 · PVG 23:27 · LAX 08:27 · JFK 11:27
    ♥ Do have faith in what you're doing.