Page 1 of 1

Loading local files into revBrowser (Mac)

Posted: Wed Mar 12, 2008 3:20 am
by Simon
Hello,
I'm having troubles with loading local files and Mac.
I've got the whole stackpath() thing down and it works well with Windows, displaying the html in the browserimage.
But what's the trick for getting Mac's to display local html?

TIA (Mark)

Simon

Posted: Wed Mar 12, 2008 10:38 am
by Mark
Haha :oops: maybe I should pass on your question to someone else, Simon? (assuming that you mean me)....

Anyway, it looks like something is wrong with the path to the html file, perhaps stackpath() returns an incorrect value, or there is a problem with the browser external on the Mac.

Are you running the Mac version as a standalone? Did you make sure to include the browser external?

Is the HTML file in the same location relative to the stack, on both Mac and PC?

If the answer to both questions is yes, could you post your stackpath() function here?

Best,

Mark

Posted: Wed Mar 12, 2008 9:15 pm
by Simon
Hi Mark,
Yes on Mac standalone.
Yes on browser external (same one used by Mac and PC?)
Yes on relative position.

Code: Select all

function stackPath
  put the filename of this stack into tPath
  set the itemdel to "/"
  if "Mac" is in platform() then
    get offset(".app/Contents/MacOS/", tPath)
    if it > 0 then
      delete char it to len(tPath) of tPath
    end if
  end if
  delete last item of tPath
  return tPath &"/"
end stackPath
I've been able to access other files using this script for both PC and Mac, just can't load local html into revBrowser on Mac. But I can load external domains.

Thanks again,
Simon

Posted: Wed Mar 12, 2008 10:07 pm
by Mark
Hi Simon,

I am not sure what you want to achieve with your function. There is no folder with the name/path returned by your function.

I assume you have an html file next to your standalone and let's assume that your standalone is called "standalone". The standalone is actually a folder. This folder is called "standalone.app".

To get the parent folder of your standalone, all you need to do is:

Code: Select all

put the effective filename of me into myPath
set the itemDel to slash
if the platform is "MacOS" then
  return (item 1 to -5 of myPath) & slash
else return (item 1 to -2 of myPath) & slash
Does this work for you?

Best,

Mark

Posted: Wed Mar 12, 2008 11:16 pm
by Simon
Hi Mark,
The part I left out of the stackPath()

Code: Select all

put (stackPath() & "intro.html") into appPath
Your code worked the same, works on PC not on Mac.
I really don't think it's a path problem as I have used my code in a bunch of apps that have no trouble finding other types of files.

I've reduced the html to just have 1 jpg in it, nothing fancy, but Mac will only show a white screen.

Regards,
Simon

Posted: Wed Mar 12, 2008 11:39 pm
by Mark
Simon,

The white screen, is that just your card?

Do you have a bundle called revBrowser.bundle in the externals folder of your standalone?

Best,

Mark

Posted: Wed Mar 12, 2008 11:57 pm
by Simon
Hi Mark,
I changed the card color to green and so no, it's not the card.

Yes, under MacOS/Externals/revbrowser.bundle

Thanks for your time on this,
Simon

Posted: Thu Mar 13, 2008 1:54 am
by Mark
Hi Simon,

I'd check that your html file exists, just to be sure:

Code: Select all

if there is a file <your file> then
  revBrowserSet gBrowserID,"url","file://" & <your file>
else
  beep
  answer "No such file!" with "Okay"
end if
Here, I assume that your file path starts with a slash. If not, you'll need to add one.

It is also possible that the jpg file specified in the html code is not available. Have you checked this?

Best,

Mark

Posted: Thu Mar 13, 2008 3:39 am
by Simon
Hi Mark,
hmm... no beep and no answer.
The html is ok, double clicking in finder Safari opens and it displays correctly.

Simon

Posted: Thu Mar 13, 2008 12:07 pm
by Mark
Hi Simon,

Can you turn on error reporting in the standalone settings and build a new standalone? Which version of Mac OS X are you using?

I have created a stack with the same setup, which works fine on Mac and Win.

I have put the stack here:

http://economy-x-talk.com/test.zip

This will stay available during the next few days.

Best,

Mark

Posted: Thu Mar 13, 2008 12:49 pm
by Mark
Simon...

You have probably ran into a bug. I did a test on Mac OS X 10.3.9.

http://quality.runrev.com/qacenter/show_bug.cgi?id=6063

Best,

Mark

Posted: Tue May 06, 2008 3:30 am
by alex298
Hi Mark,
I have created a stack with the same setup, which works fine on Mac and Win.

I have put the stack here:

http://economy-x-talk.com/test.zip

This will stay available during the next few days.
I also wish to load local webpages into the revBrowser. Could you please put your test stack on your website again?

Thanks and best regards

Posted: Sat Nov 15, 2008 2:25 pm
by Simon
OK, I found the trick (after how long???)
Because it's revBrowser running Safari, Mac needs that "File://" before the actual file name.
Should have looked closer at your code Mark.

Regards,
Simon