Skip to content

Commit

Permalink
Inject JS before content loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Dec 23, 2024
1 parent 9f2fbd4 commit 7239a4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stremio_app/stremio_wevbiew/wevbiew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl PartialUi for WebView {
Ok(())
}).expect("Cannot add full screen element changed");

webview.add_navigation_completed(move |wv, _| {
webview.add_content_loading(move |wv, _| {
wv.execute_script(r##"
try{console.log('Shell JS injected');if(window.self === window.top) {
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
Expand All @@ -133,7 +133,7 @@ impl PartialUi for WebView {
}}catch(e){}
"##, |_| Ok(())).expect("Cannot add script to webview");
Ok(())
}).expect("Cannot add navigation completed");
}).expect("Cannot add content loading");

WebView::resize_to_window_bounds(Some(&controller), Some(hwnd));
controller.put_is_visible(true).ok();
Expand Down

0 comments on commit 7239a4a

Please sign in to comment.