tuarua / WebViewANE

WebView Adobe Air Native Extension for macOS 10.10+, Windows Desktop, iOS 9.0+ and Android 19+. This ANE provides access to a more modern webview from AIR.
Apache License 2.0
183 stars 53 forks source link

Is there any way to evaluateJavascript/callJavascriptFunction/addCallback/reload/reloadFromOrigin/removeCallback/stopLoading on a tab that is not the current tab? #297

Closed ylazy closed 2 years ago

ylazy commented 2 years ago

By the way, thank you for giving us a great ANE.

ylazy commented 2 years ago

Update: Switching to another tab when the current tab is loading causes errors:

_webView.currentTab = _tabAIndex;
_webView.load(new URLRequest(_targetURL));
_webView.currentTab = _tabBIndex;

Expected result: tab A will load the _targetURL. Actual result: tab B load the _targetURL.

_webView.currentTab = _tabAIndex;
_webView.load(new URLRequest(_targetURL));

this.addEventListener(Event.ENTER_FRAME, onNextFrame);

function onNextFrame(e:Event):void
{
    this.removeEventListener(Event.ENTER_FRAME, onNextFrame);
    _webView.currentTab = _tabBIndex;
}

Expected result: tab A will load the _targetURL. Actual result: tab A and tab B load the _targetURL.

tuarua commented 2 years ago

Is there any way to evaluateJavascript/callJavascriptFunction/addCallback/reload/reloadFromOrigin/removeCallback/stopLoading on a tab that is not the current tab?

No. All operations are done only on the web view visible to the user, ie the selected "tab"

Re: tabs. I am not able to reproduce. If I use the sample project and load tab 2 then enter a new url with the following code. Everything works as expected

private function onUrlEnter(event:Event):void {
    webView.currentTab = 0;
    webView.load(new URLRequest(urlInput.text));
    webView.currentTab = 1;
    tabBar.setActiveTab(1);
}