[Interest] Detecting container app on web page

Jani Tykka jtykka at broadsoft.com
Wed Nov 2 09:57:30 CET 2016


The webpage would need to signal to it's container to do something.
With other non-Qt containers this is achieved by registering the
container as event listener. In case of Qt the webpage would instead
of postMessage just try to open url with some special scheme: like
custom://go.to/settings, then in WebEngineView we'd handle that in
"navigationRequested".

Using Qt web channel this could in theory would work by registering
custom object to receive the event, but since we have multiple web
views I'd like to avoid this approach.

Thanks,
Jani



On Wed, Nov 2, 2016 at 10:19 AM, Kai Koehne <Kai.Koehne at qt.io> wrote:
>
>
>> -----Original Message-----
>> From: Interest [mailto:interest-bounces+kai.koehne=qt.io at qt-project.org]
>> On Behalf Of Jani Tykka
>> Sent: Wednesday, November 02, 2016 7:09 AM
>> To: interest at qt-project.org Interest <interest at qt-project.org>
>> Subject: [Interest] Detecting container app on web page
>>
>> Hi,
>>
>> I load web page to QML WebEngineView. Is there any method in Javascript
>> that can be used to detect on webpage that the container app is Qt
>> application?
>>
>>Of course I could use special HTTP user-agent header or give the information
>> in URL params when requesting the web page, but I'm curious if this can be
>> done in Javascript.
>
> You could indeed check the user agent, e.g.
>
>  navigator.userAgent.includes('QtWebEngine')
>
> Anyhow, may I ask why you need to know this? Ideally you'd check for the API/functionality
> you're after, not the browser.
>
> Regards
>
> Kai
>



-- 
Jani Tykkä
Development Manager | BroadSoft, Inc. | +358 44 596 0587 | jtykka at broadsoft.com

-- 


This email is intended solely for the person or entity to which it is 
addressed and may contain confidential and/or privileged information. If 
you are not the intended recipient and have received this email in error, 
please notify BroadSoft, Inc. immediately by replying to this message, and 
destroy all copies of this message, along with any attachment, prior to 
reading, distributing or copying it.



More information about the Interest mailing list