Recent

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

josh

  • Hero Member
  • *****
  • Posts: 792
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.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

Phil

  • Hero Member
  • *****
  • Posts: 2750
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: 792
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;
   
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

 

TinyPortal © 2005-2018