Recent

Author Topic: OpenDocument on OSX not opening web pages.  (Read 2802 times)

Josh

  • Hero Member
  • *****
  • Posts: 1271
OpenDocument on OSX not opening web pages.
« on: June 02, 2017, 07:43:28 pm »
Hi

I have been using OpenDocument successfully on mac and windows to open local doc and pdf files, however I have hit a problem when
trying to open a web file, using the same code it opens on Windows, but nothing on OSX.

I have tried the following, both work in windows and not on mac.

Code: [Select]
test_link:='http://forum.lazarus.freepascal.org/index.php';
OpenDocument(''''+test_link+'''');  // read post on forum where suggested to add the ''''
OpenDocument(test_link);
Do I need to configure something to enable this, or is this a Safari issue.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: OpenDocument on OSX not opening web pages.
« Reply #1 on: June 02, 2017, 07:47:14 pm »
I have been using OpenDocument successfully on mac and windows to open local doc and pdf files, however I have hit a problem when
trying to open a web file, using the same code it opens on Windows, but nothing on OSX.

Try OpenURL?

https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html#ExternalBrowser

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: OpenDocument on OSX not opening web pages.
« Reply #2 on: June 02, 2017, 08:31:29 pm »
Hi Phil

Thanks for your input, I have modified code now which seems to work.
It might work with just openurl, but as just url was my issue filtered just for http, as OpenDocument working fine for other file types.

Code: [Select]
ext_link:=trimleft(ext_link); // remove any preceding spaces 
try
  if upcase(copy(ext_link,1,4))='HTTP' then OpenUrl(ext_link)
  else OpenDocument(ext_link);
except
  // handle any error
end;
   
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018