V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tanorigin
V2EX  ›  iOS

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

  •  
  •   tanorigin · 2016-02-26 10:25:41 +08:00 · 1633 次点击
    这是一个创建于 3005 天前的主题,其中的信息可能已经有所发展或是发生改变。
    问题描述: 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 条回复    2016-02-26 11:14:34 +08:00
    tanorigin
        1
    tanorigin  
    OP
       2016-02-26 11:14:34 +08:00
    已解决 谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1107 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:07 · PVG 02:07 · LAX 11:07 · JFK 14:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.