Help with displaying content(pdf) inside revbrowser please

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
chasecon
Posts: 2
Joined: Wed May 25, 2016 11:51 pm

Help with displaying content(pdf) inside revbrowser please

Post by chasecon » Thu May 26, 2016 12:02 am

Hey, I've been trying some tutorials online to display links/files/PDFs without using an external program. They have been saying to use revBrowser and the google button works at loading google inside the stack, but the search for pdf button tries to open it in firefox and not inside the stack. The tutorials all say (I've looked at many) that this should work. Any idea what I'm doing wrong?


The app is just one stack with an image thing and two buttons

here is the stack code

Code: Select all

        global myBrowser

        on browserOpen
                if myBrowser is empty then
                     put revBrowserOpen(the windowid of this stack,"") into myBrowser
                end if
                revBrowserSet myBrowser, "showborder","true"
                revBrowserSet myBrowser, "visible","true"
                revBrowserSet myBrowser, "rect",rect of image "bwin"
        end browserOpen

        on browserClose
                revBrowserClose myBrowser
                put empty into myBrowser
end browserClose

on browserSetURL pURL

## Set the url to be displayed to the given url

revBrowserSet myBrowser, "url", pURL

end browserSetURL
google button

Code: Select all

             global myBrowser

               on mouseUp
                    browserOpen
                    revBrowserSet myBrowser , "url", " google (.)  com"
               end mouseUp
pdf search button

Code: Select all

                    global myBrowser

                   on mouseUp
                             browserOpen

                             local tFile
                             answer file "Please choose the file you would like to display" with type "PDF document|pdf|PDF"
                             if it is not empty then
                                    put it into tFile
                                    --revBrowserSet myBrowser , "url", tFile
                                    browserSetURL tFile
                            end if
                    end mouseUp

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Help with displaying content(pdf) inside revbrowser plea

Post by Klaus » Thu May 26, 2016 11:34 am

Hi chasecon,

1. welcome to the forum! :D

2. You need to tell the browser that you want to open a LOCAL file like this:

Code: Select all

...
answer file "Please choose the file you would like to display" with type "PDF document|pdf|PDF"
if it is not empty then
  put "file://" & it into tFile
  browserSetURL tFile
end if
...
Best

Klaus

chasecon
Posts: 2
Joined: Wed May 25, 2016 11:51 pm

Re: Help with displaying content(pdf) inside revbrowser plea

Post by chasecon » Thu May 26, 2016 8:48 pm

Klaus wrote:Hi chasecon,

1. welcome to the forum! :D

2. You need to tell the browser that you want to open a LOCAL file like this:

Code: Select all

...
answer file "Please choose the file you would like to display" with type "PDF document|pdf|PDF"
if it is not empty then
  put "file://" & it into tFile
  browserSetURL tFile
end if
...
Best

Klaus
thanks for the reply! I have tried adding that to the code, but it still is trying to open the pdf in firefox externally. This is driving me insane!!

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Help with displaying content(pdf) inside revbrowser plea

Post by Klaus » Fri May 27, 2016 1:38 pm

Hi chasecon,
...but it still is trying to open the pdf in firefox externally.
Too funky!? :shock:

Hmm, no idea what is going on there...

But I see that you only check if "myBrowser" is not empty, you should check if "myBrowser" is a NUMBER!
If an error occurs that variable will contain that error and is also not empty!

And add a little check after trying to open the PDF file, maybe that will gived a hint:

Code: Select all

on browserSetURL pURL
   ## Set the url to be displayed to the given url
   revBrowserSet myBrowser, "url", pURL

   if the result <> EMPTY then
      answer "Error:" && the result
  end if
end browserSetURL
Best
Klaus

Post Reply

Return to “Internet”