Unexpected behavior while using browser object.

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

Unexpected behavior while using browser object.

Post by reelstuff » Sun Oct 21, 2007 4:27 pm

Hello, everyone, I have been trying to work with the browser object,
(I think I have that right?)

I have been testing out various functions attempting to get a fully functional browser.

So far, the only way I have found to do this consistently is to use

revGoURL "http://www.example.org/info.html"

My goal is to provide a consistent user interface, using the revBrowser object.

However, I have run into some interesting behavior, which at this writing I have not figured out as yet.

I am wondering if anyone else has encountered these type problems and may share the "secret" to working with a base browser that creates the type of functionality contained when using revGoURL,

Here are some examples,

loading a flash object often results in a difficulty in communication between flash and the browser shell, double and triple clicks are often required to activate a field in flash.

While the same content using revGoURL works perfectly in each respective operating system, obviously this is something that requires scripting to create this functionality in each browser instance, scripting that is cross platform, MAC Win, being an additional challenge.

What I want to do is present my own content using a customized browser object, which, when needed, has the same functionality of the shell on which it (revbrowser) is based.

The challenges are these,

Downloads,
open links in new window,
open PDF documents,
Certain JAVA script commands ect.

For an example, in the documentation,

Code: Select all

The browserDownloadRequest message is sent to the current card of stack containing a browser object when a url has been requested as a download. 

On Windows, if the browserCancel global is set to false on exit from the callback, the browser proceeds to download the file.

On OS X, the callback is a notification only and downloading should be performed by the host application.
After reading this I find myself lost with regard to finding a solution to the issue, since no applicable reference to applying the data is provided, or my knowledge level is such that I cannot grasp the intended communication of knowledge to the reader, I find myself wondering if this is just me, or is this something that effects other users in the same way.

I am certainly willing to accept my own weakness in understanding the documentation as it is written, example,

Code: Select all

Summary: 
Sent when a download has been requested in a browser object.

Examples: 
on browserDownloadRequest pInstanceId, pUrl
  if urlForbidden(pUrl) then
    global browserCancel
    put true into browserCancel
  end if
end browserDownloadRequest
Looking at the code above, I notice that it contains if statements that I dont need or want in my example, since I am presenting my own content only and no other content, and I am not providing my audience with alternatives to the content that I want them to see.

So I evaluate the statements and attempt to create a script that will serve my needs however I find myself again lost in the example as I dont see how it actually handles the download request, in another example, the script example gives,

Code: Select all

on browserDownloadRequest pId, pUrl
  answer information "The browser is attempting to download the file: " & return & \
      pURL & return & return & "Please handle this in the 'DownloadRequest' callback'"
  abIamNotBusy
  #revBrowserStop the altBrowserId of this stack
end browserDownloadRequest
I looked in the documentation and could not readily identify how to handle this callback, again perhaps is it a knowledge and experience issue, however, I would like to learn and thus far I find it difficult to learn from the documentation as it is written.

Something that is unusual for me, normally I find documentation to be of great use in determining the correct course of action.

In these cases I just find it frustrating in that it appears that in order to use the browser object you have to script each and every possible action that the user may need, this seems strange to me as the functionality is already there in the shell of these browsers, so my question after writing a book here, is there not an easier method of using the browser object with the desired functionality without having to rewrite the functions that should be handled in the library of the object.

I am wondering if anyone else has experienced these type of issues and has overcome these challenges and would be willing to share the
knowledge so that the community as a whole may benefit from their experience.

any thoughts and suggestions are always welcomed.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Mon Oct 22, 2007 12:47 am

The browser object is only a viewer for online web content. Therefore everything exceeding that, needs scripting from your part.

This includes downloading stuff. The browserDownloadRequest message tells you the requested url. one very simple example to use it could be this (untested):

Code: Select all

on browserDownloadRequest pInstanceId, theRequest
put url theRequest into url ("binfile:" && specialFolderPath("Desktop")
end browserDownloadRequest 
Of course this doesn't give you a progress bar, or a download manager, as you know it from other browsers, but it should download just fine.

Opening new windows/instances is not happening within a single browser object either, therefore you have to script this yourself. Use the "browserNewURLWindow" message to create new windows with browser objects, then use the "revBrowserNavigate" command to set the content of your new Browser window.

PDF's can't be opened by the browser on the Mac anyway, as there is no Adobe PDF plugin for Safari. As far as I know, they do open fine on windows though.

Java should just work, as should Javascript and flash, if they don't it's normally not working in IE respectively Safari either, or a bug in the Rev browser Object.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

Post by reelstuff » Mon Oct 22, 2007 3:12 am

Thank you, that helps a lot, sometimes it is a little frustrating trying to understand the documentation, (it is like someone wrote it as an after thought)

Your explanation makes much more sense to me I appreciate that.

I can see how to manage the download process now.

again thank you.

Tim

Post Reply

Return to “Internet”