Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Stop() method #28

Closed
dd8 opened this issue Jun 28, 2019 · 7 comments
Closed

No Stop() method #28

dd8 opened this issue Jun 28, 2019 · 7 comments
Labels
feature request feature request

Comments

@dd8
Copy link

dd8 commented Jun 28, 2019

Windows.UI.Xaml.Controls.WebView has Stop() method
MFC CHtmlView has Stop() method
MsHtml IWebBrowser2 has Stop() method
macOS WkWebView has stopLoading() method

There is a put_Cancel method on IWebView2NavigationStartingEventArgs, but communicating a stop command from the UI to the navigation delegate is a lot more complex than just calling webView->Stop()

Given modern browser UIs merge the Stop and Refresh buttons I'd expect to be able to write something as simple as this:

OnClickedStopOrRefresh()
{
 if ( IsLoading() )
  webView->Stop();
 else
  webView->Refresh();
}
@liminzhu
Copy link
Member

Thanks for the feedback! Sounds reasonable to me that you'd want a cancel/stop functionality outside of the navigationStarting event. We will look into it.

If you don't mind me asking, what are you planning to build with WebView?

@dd8
Copy link
Author

dd8 commented Jun 28, 2019

We have a couple of desktop products that use WebViews for part of the UI, and for capturing page thumbnails. On Windows we've used MsHtml since IE 3.0 was released, and on Mac we use the WebKit Framework. We're planning to migrate the Windows products to the Edge/Chromium WebView on Windows.

The products are here:
https://www.powermapper.com/products/sortsite/
https://www.powermapper.com/products/mapper/

You can see how the WebView is used here. This is a Mac screenshot, but our Windows UI is being updated to look like this:
Screen Shot 2019-06-28 at 20 51 42

@liminzhu
Copy link
Member

Thanks, this is really cool to see!

@dd8
Copy link
Author

dd8 commented Jun 28, 2019

We have a working prototype of our product using WebView2. The dev preview was simple to integrate into our code (took less than a day to get a working UI) and seems very stable so far. Still a few things to do, so we'll probably find a few more feature gaps.

@david-risney david-risney added the feature request feature request label Jun 28, 2019
@liminzhu
Copy link
Member

Hey @dd8 , as requested we've made a new Stop API in the latest release. Let us know if this work for ya!

@verelpode
Copy link

Thanks for creating the Stop method -- that was certainly a useful addition. However, what about stopping script execution? Does or should the Stop method stop the running of all scripts in the webpage? I'd like to suggest that the documentation for Stop be updated to explain how it does or doesn't affect scripts. Currently it says only:

"Stop all navigations and pending resource fetches."

If the final decision is that Stop shouldn't stop scripts, then I suggest:

  1. Rename Stop to StopLoading; and
  2. Create a method named StopExecutingScripts or StopScriptExecution.

Here are a couple of examples of the usefulness of stopping scripts:

  • A "Stop" button similar to a "Stop" button in a web browser could stop downloading, loading, fetches, and all scripts in the webpage.
  • A StopScriptExecution method would also be useful in conjunction with the existing ExecuteScript method.

Also, why does Stop appear in both of IWebView2WebView2 and IWebView2WebView3?

Will IWebView2WebView2 and IWebView2WebView3 be removed in the first release version of WebView2 and their members merged into IWebView2WebView? I hope so. Prior to the first release, while WebView2 is still in beta, I think it's acceptable for an interface (IWebView2WebView) to be changed in a way that breaks compatibility with the previous beta version. There is no need to retain backwards-compatibility baggage before the first release version.

@david-risney
Copy link
Contributor

Stop was added for folks creating browser like scenarios and so that guides how Stop behaves currently. I'll look into how it interacts with script and get that updated (#50 ). We can look into improvements to Stop related functionality in the future.

Stop appears in both interfaces because we want to have the version suffixed interfaces derive from their previous version so we only need to have a pointer to the latest version suffixed interface. IWebView2WebView2 only had Stop on it, so rather than making a breaking change to the interfaces we just added Stop to IWebView2WebView3. We plan to make a breaking change for v1 where we merge all the version suffixed interfaces back down to just one interface. So yes the duplicate Stop is awkward now, but will be addressed in a future breaking change and for sure before we're out of developer preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

5 participants