Manage tabbed web browser

I need to have a list view of new versions of IE in a WPF WebBrowser . How can i achieve this?

Do I need to use TabControl and the WebBrowser host in each of the tabs? I thought that there might be a better way to have a tabbed view in WebBrowser itself, because some of the functions are very conveniently controlled by the IE plugin itself, such as the option โ€œOpen in Bookmarkโ€, โ€œDrag and Drop and Organize Tabsโ€, open a new tab with URL default address, etc.

If I go the TabControl path, then I have to recreate all these functions. Any wild inputs are welcome. :-)

thanks.

EDIT

The decision on how to enable the "Open in Tab" option with the right mouse button in your WebBrowser .

 using System; using System.Runtime.InteropServices; namespace TabbedBrowsing { public enum INTERNETFEATURELIST { FEATURE_OBJECT_CACHING = 0, FEATURE_ZONE_ELEVATION = 1, FEATURE_MIME_HANDLING = 2, FEATURE_MIME_SNIFFING = 3, FEATURE_WINDOW_RESTRICTIONS = 4, FEATURE_WEBOC_POPUPMANAGEMENT = 5, FEATURE_BEHAVIORS = 6, FEATURE_DISABLE_MK_PROTOCOL = 7, FEATURE_LOCALMACHINE_LOCKDOWN = 8, FEATURE_SECURITYBAND = 9, FEATURE_RESTRICT_ACTIVEXINSTALL = 10, FEATURE_VALIDATE_NAVIGATE_URL = 11, FEATURE_RESTRICT_FILEDOWNLOAD = 12, FEATURE_ADDON_MANAGEMENT = 13, FEATURE_PROTOCOL_LOCKDOWN = 14, FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15, FEATURE_SAFE_BINDTOOBJECT = 16, FEATURE_UNC_SAVEDFILECHECK = 17, FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18, FEATURE_TABBED_BROWSING = 19, FEATURE_SSLUX = 20, FEATURE_DISABLE_NAVIGATION_SOUNDS = 21, FEATURE_DISABLE_LEGACY_COMPRESSION = 22, FEATURE_FORCE_ADDR_AND_STATUS = 23, FEATURE_XMLHTTP = 24, FEATURE_DISABLE_TELNET_PROTOCOL = 25, FEATURE_FEEDS = 26, FEATURE_BLOCK_INPUT_PROMPTS = 27, FEATURE_ENTRY_COUNT = 28 } public enum DWFLAGS { SET_FEATURE_ON_THREAD = 0x00000001, SET_FEATURE_ON_PROCESS = 0x00000002, SET_FEATURE_IN_REGISTRY = 0x00000004, SET_FEATURE_ON_THREAD_LOCALMACHINE = 0x00000008, SET_FEATURE_ON_THREAD_INTRANET = 0x00000010, SET_FEATURE_ON_THREAD_TRUSTED = 0x00000020, SET_FEATURE_ON_THREAD_INTERNET = 0x00000040, SET_FEATURE_ON_THREAD_RESTRICTED = 0x00000080 } public static class IEFeatureSetBehavior { [DllImport("urlmon.DLL")] public static extern Int32 CoInternetSetFeatureEnabled(INTERNETFEATURELIST featureEntry, Int32 dwFlags, bool fEnable); [DllImport("urlmon.DLL")] public static extern Int32 CoInternetIsFeatureEnabled(INTERNETFEATURELIST featureEntry, Int32 dwFlags); public static void EnabledTabbedBrowsing() { var lr = 0; var featureToEnable = INTERNETFEATURELIST.FEATURE_TABBED_BROWSING; if (CoInternetSetFeatureEnabled(featureToEnable, (Int32)DWFLAGS.SET_FEATURE_ON_PROCESS, true) == 0) { if (CoInternetIsFeatureEnabled(featureToEnable, (Int32)DWFLAGS.SET_FEATURE_ON_PROCESS) != 0) { lr = 2; } else { lr = 1; } } } } } 

We just need to call

 IEFeatureSetBehavior.EnabledTabbedBrowsing(); 

in your Window constrcutor. All WebBrowser controls now activate the Open in Tab parameter by right-clicking \ wheel click \ Ctrl + click.

But it will not contain aTabControl in your WebBrowser . The parameter opens an instance of IE browser with the corresponding link open as a tab .:(

But, nevertheless, there is another way. We can know about the tabbed view request. If the user tries to invoke tabbed browsing, the item is raised by the WebBrowser . We can handle this event and based on this create a new TabItem with another web browser control in it, which is part of the WPF TabControl that wraps our previous web browser control.

Greetings.

:-)

+4
source share
2 answers

The way you suggested (placing a WebBrowser in a TabControl ) is probably as good as it gets.

Be that as it may, you will still run into walls quickly, because the WebBrowser control is very limited. All you can do with the bass player is open the URL and scroll and click on it. You will not get the API for the DOM that you need if you want to provide a context menu action, such as "Open in a new tab."

What can also be said, you can take a look at Awsomium , which is a much more sophisticated tool for managing a web browser, but, unfortunately, may not be free for you .

+1
source

All Articles