Web gadget use

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

LO,

Does one have tested Web gadget deeply ? My question is :

- when surfing the Web in a Web gadget, you can check the current URL using GetGadgetText but ... if the web site forces the displayed URL to be left as it is (ie : home page URL) you will never catch the true last used URL inside this site. The GetGadgetText does not catch the page URL but the link usually displayed in Internet Explorer URL string gadget.

Does it exist any way to catch the true current URL, or in worst case a simple way to catch the content of last received page ?

I checked the MSDN verbose information but could not find the right stuff to do it.

Rgrds

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.

It seems you're right, also it only takes from the IE cache - there seems to be no way to force a reload
Ta - N
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

This forces a reload. The document is retrieved from the cache or from the server, depending on user preferences:

Code: Select all

SetGadgetText(#WebGadget, "javascript:window.location.reload();")
Bye,


El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

OK El_Choni it reloads from cache or network.

My question went from that I would like to manage the displayed content in the Webgadget and the only way I found up to now is using URLDownloadToFile_ for locally caching the current displayed page. Calling GetGadgetText on the WebGadget allow to locally cache the page when testing if the URL has changed.

Forcing the reload using Javascript works but does not apply because it does not tell you anything more when the displayed URL is the same obviously the content has changed.

So I was wondering wether it was possible to continue in that way without to be dependant of Internet Explorer cache files that I do not feel able to handle.

...

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.

Code: Select all

SetGadgetText(#WebGadget, "javascript:window.location.reload();")
Thanks ElChoni - that works great - Why didnt I think of it :wink: !
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.
LO,
- when surfing the Web in a Web gadget, you can check the current URL using GetGadgetText Rgrds
Hi - Ok - I've got a neat/nasty/sneaky way of doing it - haven't tried it, but I know it'll work.

The problem is that PB has no means of getting this (unless there's some sort of API wierdness that'll do it) You can obviously get the current URL via javascript, but javascript has no means of communicating with PB directly, so you need an indirect way of doing it...

Answer=Cookies

- set a persistent cookie (ie with an expiration date so that it gets written out to C:\Documents and Settings\\Cookies\[url]mailto:myUserId@xyz.txt[/url]) according to the current and then read the value back with PB.

I think the code to record the cookie would look something like this:

SetGadgetText(#WebGadget, "javascript:document.cookie='url='+location.href+'; expires=expires=Fri, 31 Dec 2100 23:59:59 GMT'")


And just use regular PB commands to recover the url.

;-)

I'd love to see the results...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

Sorry indeed ... but using location.ref does not change the issue.

This comes from that many web sites are generating dynamic pages using a fixed URL for variable content.

When accessing such a website, you will have a content when clicking a link ie by sending a form with hidden variables. But the URL never changes.

BTW if you want to work on this received content (parsing the page for any purpose) the best is to process the information received on the client workstation. This content is usually cached by the browser, but browser's caching method is rather tricky to access.

This is the reason why in the case I work on, I would prefer to get a local copy of just the current displayed page (containing just the page / frames source code) rather than anything else.

When pages are called using build URLs (where page parameters are possible to put in the URL) it is always possible to call the page back with such a unique URL which allows to cache the page, but this is not always the case because some servers use cgis or any dynamic server layer including hidden parameters with other stuff (linked to use current session). And so it is never possible to access directly with a unique URL to the content you focus on.

And without a unique URL ...

So I will forget it for the moment.

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

I don't know how to use this with WebGadget, but these are the methods allowed by the IWebBrowser2 interface, which is used by WebGadget and by this snippet posted by Fred:

br / [url]http://forums.purebasic.com/e ... php?t=1655 Support%3F&Forum_Title=Beginners[/url] Support%3F&Forum_Title=Beginners

Retrieved from http://msdn.microsoft.com/library/defau ... owser2.asp:

Inherits from IDispatch, so first members are:

Code: Select all

#QueryInterface  Returns pointers to supported interfaces. 
#AddRef Increments reference count. 
#Release Decrements reference count. 
IDispatch Methods Description 
#GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1). 
#GetTypeInfo Gets the type information for an object. 
#GetIDsOfNames Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs. 
#Invoke Provides access to properties and methods exposed by an object.
IWebBrowser2 Members

Code: Select all

#AddressBar Sets or retrieves whether the address bar of the object is visible or hidden. 
#Application Retrieves the automation object for an application that is hosting the WebBrowser Control. 
#Busy Retrieves a BOOL value indicating whether the object is engaged in a navigation or downloading operation. 
#ClientToWindow Converts the client coordinates of a point to window coordinates. 
#Container Retrieves an object reference to a container. 
#Document Retrieves the automation object of the active document, if any. 
#ExecWB Executes a command on an OLE object and returns the status of the command execution using the IOleCommandTarget interface. 
#FullName Retrieves the fully qualified path of the Microsoft Internet Explorer executable file. 
#FullScreen Sets or retrieves a VARIANT_BOOL value that indicates whether Internet Explorer is in full-screen or normal window mode. 
#GetProperty Retrieves the value of a property associated with the given object. 
#GoBack Navigates backward one item in the history list. 
#GoForward Navigates forward one item in the history list. 
#GoHome Navigates to the current home or start page. 
#GoSearch Navigates to the current search page. 
#Height Sets or retrieves the height of the Internet Explorer main window. 
#HWND Retrieves the handle of the Internet Explorer main window. 
#Left Sets or retrieves the screen coordinate of the left edge of the main window of the object. 
#LocationName Retrieves the name of the resource that Internet Explorer is currently displaying. 
#LocationURL Retrieves the URL of the resource that Internet Explorer is currently displaying. 
#MenuBar Sets or retrieves a VARIANT_BOOL value that indicates whether the Internet Explorer menu bar is visible. 
#Name Retrieves the name of the object that contains the WebBrowser Control used by Internet Explorer. 
#Navigate Navigates to a resource identified by a URL or to the file identified by a full path. 
#Navigate2 Navigates the browser to a location that might not be able to be expressed as a URL, such as a pointer to an item identifier list (PIDL) for an entity in the Microsoft Windows® shell namespace. 
#Offline Sets or retrieves a VARIANT_BOOL value that indicates whether the object is currently operating in offline mode.  
#Parent Retrieves the parent of the object. 
#Path Retrieves the full path to the object. 
#PutProperty Sets the value of a property associated with the object. 
#QueryStatusWB Queries the OLE object for the status of commands using the IOleCommandTarget::QueryStatus method. 
#Quit Closes the object.  
#ReadyState Retrieves the ready state of the object. 
#Refresh Reloads the file that is currently displayed in the object. 
#Refresh2 Reloads the file that is currently displayed in the object. Unlike IWebBrowser2::Refresh, this method contains a parameter that specifies the refresh level. 
#RegisterAsBrowser Sets or retrieves a value that indicates whether the object is registered as a top-level browser for target name resolution. 
#RegisterAsDropTarget Sets or retrieves a value that indicates whether the object is registered as a drop target for navigation. 
#Resizable Sets or retrieves a value that indicates whether the object can be resized. 
#ShowBrowserBar Shows or hides a specified browser bar. 
#Silent Sets or retrieves a value that indicates whether the object can show dialog boxes. 
#StatusBar Sets or retrieves a value that indicates whether the status bar for the object is visible. 
#StatusText Sets or retrieves the text in the status bar for the object. 
#Stop Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. 
#TheaterMode Sets or retrieves a value that indicates whether the object is in theater mode. 
#ToolBar Sets or retrieves a value that indicates whether the toolbar for the object is visible. 
#Top Sets or retrieves the screen coordinate of the top edge of the main window of the object. 
#TopLevelContainer Retrieves a value that indicates whether the object is a top-level container. 
#Type Retrieves the type name of the contained document object—that is, Windows HTML Viewer. 
#Visible Sets or retrieves a value that indicates whether the object is visible or hidden. 
#Width Sets or retrieves the width of the main window for the object. 
There are also event capturing methonds for the WebControl object: http://msdn.microsoft.com/workshop/brow ... owser2.asp

Maybe some of these are useful to you. Bye,

El_Choni

Edited by - El_Choni on 18 July 2002 11:56:03
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.

Doh!

Seemed like such a good idea at the time :-(
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Question:
For the use of the WebGadget ATL.DLL is required, but what is with IE, it's required too
Does it mean, if you use a WebGadget in your Application the users of yours need to install IE



Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

The prerequisite for use of WebGadget was exactly to have an working Internet Explorer on the workstation (don't remember the posted topic ref about).

As I am looking for platform non-dependant design, I started slowly with Web Gadget. But in fact most of client side workstations are Windows based so that it should not be a huge problem to design apps using Web Gadget as it is, because IE is part of the basic MSWindows installation.

Just it makes some more features to make accessible in PureBasic related to Web Gadget if we want to have a true navigation toolset access.

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TronDoc.

so what do us Linux wannabees do?

elecTRONics DOCtor
{registeredPB}P150 32Mb w98/DOS/Linux NO DirX NO IE :wink:
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

I suppose it will be tricky to find a substitution procedure for Web gadget
but AFAIK it should be possible to make a Netscape compatible gadget and so on.

Just I do not fill good enough to start with it !

BTW is it possible or not to run IE on Linux, as it is possible using a Mac (not with MacOS I know).

The good question would be what workaround to make a PureBasic integrated Web browser library, with no use of system DLLs.

Francois Weil
14, rue Douer
F64100 Bayonne
Post Reply