0

I'm going to try and make this as detailed as possible on the first go around, lord knows I'll probably miss something.

What I do have so far is a program that can call the default web browser, which is good. What I'm trying to get to, I'll break down into steps because frankly I doubt they are all contingent on each other:

  1. The current call will only open up a new tab if the default web browser is already open. Ideally, I want it to create a new window instance every time it is called, for specific reasons that will relate to #3. How I currently have it is thus:

    System.Diagnostics.Process.Start(storage.urls[storage.tabcount-1]);
    

    I have also tried the code snippet provided here, but either Visual Studio 2015 no longer supports the BrowserApplication class, or I'm missing a using somewhere, but there is precious little information about that class. There is probably a really simple solution for this one.

  2. (Optional) Wrap the newly called web browser in a windows form. Let's face it, this one is essentially unnecessary, but for visual sake I wouldn't complain to being able to wrap the web browser inside a windows form. It would probably make doing things like resizing the browser and moving it around a lot easier. Still, it's pretty low on my list of things to do. But, it does tie 1 and 3 nicely together.

  3. Make the newly create web browser a child of the main application. I really want a way to be able to read information and set things about the web browser through the program at any time. Being able to make it a child would likely give me access to that feature. There's probably some kind of integration dll I can add to the program, but a few things are preventing me from looking. First, I still can't get the browser to open up in a new window, and I don't want to control all the already existing tabs as well. Second, I really want the code to not be browser dependent. It's one of the reasons why I want it to just open up the default browser, because I want the user to not notice any difference from their normal browsing habits.

The obvious solution for probably about 90% of my issues is to just code in a webbrowser tool into a windows form. It is my fallback option, but I have a few things I don't like about it. Primarily, I then have to reinvent the wheel in terms of creating multi tab functionality in a web browser as well as all other browser features. In the end, the user is also going to end up noticing a big disjoint from their normal browsing experience.

Community
  • 1
  • 1
Naryna
  • 121
  • 9
  • Most modern browsers display a webpage in a sandbox and do little to support manipulation from outside world. I see three options: 1) browser extension, 2) local proxy server, 3) completely read and perform OCR on browser screenshot. None of these seem good enough though. Perhaps if you can provide more details on what you want to achieve in the end could help us to come up with a better answer. – Dmitri Trofimov Jul 14 '15 at 06:45
  • The overall program is bigger, but all I really want to achieve for the browser portion is to be able to read browser position, size, and the urls from any open tabs. The basic idea is to be able to save these settings to a file and instantly reload whichever browser tabs in the exact same position. I've been working based on default browser, because I want the file to be able to travel to any computer and still re-open the same tabs. I **DO NOT** care about reading any data or information from the tabs, just the url's in them. – Naryna Jul 16 '15 at 04:24
  • It is possible to determine and manipulate a window's state and position, but I can't think of a way to read currently open tabs and URLs, since all browsers a different. Perhaps writing addons for several browsers and installing them along with your app can work... Long story short, there is no standard interface you can use to query "Ok, Windows, give me the current default browser location and open tab urls". It will be a lot of tedious work. You'd best be with using the WebBrowser component on your form... – Dmitri Trofimov Jul 16 '15 at 07:46

0 Answers0