2017-07-06 52 views
1

Hej sry當我問,但是有沒有辦法在nw.js應用程序中使用webview標記,而webview下的所有內容都覆蓋在影子根目錄中?使用webview創建NW.js但沒有shadowprotect

<webview id="foo" src="file:///C:/Users/midjo/Desktop/TEST.html" style="display:flex; height:100%; width:100%;" partition="trusted" tabindex="-1"> 

影子根(開)

回答

0

沒有,但影子根是好的,可以很容易地做任何你想要與DOM裏面。 例如:

<webview id="foo" src="test.html" partition="trusted" style="display: flex;"></webview> 
<script> 
    foo.addEventListener('loadstop', e => { 
     foo.executeScript({ 
      code: `document.querySelector('body').innerText;` 
     }, result => { 
      console.log(result); 
     }); 
    }); 
</script> 

您可以得到任何內容,點擊的東西,甚至注入任何的js文件。

相關問題