VB.Net More on Web Browser Favourites Tutorial

VB.Net More on Web Browser Favourites Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

VB.Net More on Web Browser Favourites Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

Do you remember the tutorial VB.Net Web Browser Favourites Primer Tutorial? Well, with this tutorial we add an onion layer on top. This is the way I really like to program. Get the essence right first, then build onion layers on top, and have supervisors of supervisors of supervisors … for Onion a then Onion 1-a then Onion A-1-a … then Onion of the Fourth Dimension! So that new onion layer of ours is to have the Dropdown selection do something before it goes off to that Dropdown My Favourite URL selection. Guess what might be a good thing to use for such an in between (interventionist) procedure. We have HTML, so what can be like an onion layer on top of the client-facing HTML/Javascript? Something server-side? What about PHP? So we’ll get the VB.Net to write its own PHP. Why not? It knows where to write it, because, as with the previous tutorial, it assumes you have EasyPHP going ( big assumption, but think you can handle the changes if you have another local webserver arrangement … hint: look for code with //127.0.0.1 ).

This PHP does a line and character count of the destination URL and does a (bit of an awkward HTML) word count as well, showing this to you in a Javascript alert() box before proceeding to the actual website using window.location=’?’ methods.

Download this VB.Net code as required and rename to Module1.vb.


Previous tutorial VB.Net Web Browser Favourites Primer Tutorial

VB.Net Web Browser Favourites Primer Tutorial

VB.Net Web Browser Favourites Primer Tutorial

VB.Net using Visual Studio is another great language to learn. If you like VB.Net you may eventually like C#, and vice versa. It has sophisticated data structures, can be Object Oriented and makes great Windows desktop applications or can be the code behind an ASP.Net website or web application. Here we use it in a Visual Studio Console Application project, used because what we are using VB.Net for here does not require a Windows Form.

To understand why we use VB.Net to do this job of displaying the Web Favourites in a dropdown, we must understand how Javascript and other client web languages can not access the underlying operating system of the client computer (laptop, in our case). Why should that matter? Well, Web Favourites are controlled by the Web Browser, which is a desktop program that has access to local file systems and the operating system of the client. This Web Browser (and for this .Net application we are defaulting to Internet Explorer) saves its Web Favourites to the file system of the client and controllable by the client operating system, but therefore, not accessible to Javascript or other web browsing client agents. So what can we do, to achieve the aims of this tutorial? Well, what I’ve decided to do, is to assume you are using an EasyPHP local web server, and to write a Visual Studio VB.Net desktop (console) application that can reach, access and read those Web Favourites files and write to EasyPHP’s //127.0.0.1/ (the mapping of which can be gleaned by looking at the client’s PATH environment variable and was C:\Progra~1\EasyPHP-12.1\www in my case), to a file called MyFavourites.html and finish off by executing that MyFavourites.html with Internet Explorer. You’ll be getting the hint that this is a Windows tutorial, but as soon as I said VB.Net that had to be the case!

You could well ask why do this, when the browser can do it, but you may have forgotten what a programmer does, and is interested in. A programmer arranges to be able to make things happen in a controllable way, so with what this program does, it could be extended in functionality to do a lot of other things now that the data is web-accessible for both client and server, from using PHP or ASP.Net server-side programs to write to files or a database, or to glean information from the Web Favourites list destination websites (which we may do in another tutorial of the future … VB.Net More on Web Browser Favourites Tutorial). Of course there would be other ways to achieve this same result.

So let’s see this tutorial.

Download this VB.Net code as required and rename to Module1.vb.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in Animation, eLearning, Event-Driven Programming, GUI, Operating System, Software, Tutorials, Visual Studio and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>