Equivalent of a field's "on linkclicked" message in a browser widget?

Klaus major-k klaus at major-k.de
Thu Dec 8 13:25:14 EST 2022

Hi Jacque,

> Am 08.12.2022 um 19:06 schrieb J. Landman Gay via use-livecode <use-livecode at lists.runrev.com>:
> I guess it hasn't been fixed yet, or else we don't understand how to use it. When I was trying it, breakpoints didn't even trigger so I assumed the messages weren't being sent. Did you put the handlers in the widget script?


> When I tested we didn't have widgets yet.
> If that doesn't work I'm not sure what will. Maybe you'd need some javascript?

I hope not! :-D
Maybe someone will chime in with a clever hint...

> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
> On December 8, 2022 5:25:32 AM Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
>> Hi Jacque and all,
>>> Am 06.12.2022 um 22:24 schrieb Klaus major-k via use-livecode <use-livecode at lists.runrev.com>:
>>> Hi Jacque,
>>>> Am 06.12.2022 um 21:59 schrieb J. Landman Gay via use-livecode <use-livecode at lists.runrev.com>:
>>>> On 12/6/22 1:13 PM, Klaus major-k via use-livecode wrote:
>>>>>> what is the browser widget's equivalent to a field's "on linkclicked tLink" message?
>>>>>> Thanks for any hint!
>>>>> I want to check if the user clicked e.g. a PDF file and download the file in that case.
>>>>> What message do I have to catch in the browser widget?
>>>> You could try "browserDocumentLoadBegin" or "browserNavigateBegin" which would give you the URL that was clicked. But most browsers now download or display the PDF automatically when a PDF link is clicked. Firefox opens the PDF in a new window, and I think Safari downloads it. Not sure about Windows.
>>> Windows, too, if the Acrobat Plug-in is installed on the target machine.
>>> Only Android cannot display in a browser so far, too bad.
>>>> If this is for mobile, the URL might be enough information. BTW, I tried to use these messages a very long time ago and they were not sent, but hopefully that's been fixed by now.
>>> Fingers crossed, will try and tell. :-)
>>> Thank you!
>> macOS 12.6.1, LC 9.6.9 rc2
>> I tried:
>> --------------------------------------
>> on browserNavigateBegin pUrl
>>  if pURL ends with ".pdf" then
>>     libURLDownloadToFile pUrl, (specialfolderpath("dektop") & "/test666.pdf")
>>  else
>>     pass browserNavigateBegin
>>  end if
>> end browserNavigateBegin
>> on browserDocumentLoadBegin pUrl
>>  if pURL ends with ".pdf" then
>>     libURLDownloadToFile pUrl, (specialfolderpath("dektop") & "/test666.pdf")
>>  else
>>     pass browserDocumentLoadBegin
>>  end if
>> end browserDocumentLoadBegin
>> ------------------------------------------
>> No file on the desktop, the browser simply ignores the script!?
>> So any hint on how to download a clicked linke in the browser widget still welcome!



Klaus Major
klaus at major-k.de

More information about the use-livecode mailing list