简体   繁体   中英

detecting hold event in webview on windows phone 8.1

I'm currently working on a web browser app mainly targeting win rt in Windows phone 8.1. I'm now trying to figure out how to detect the hold event when a user holds down a link or image in webview and display a context menu.

How would I go about doing this? How would I detect the event in wp8.1? I know I'll have to invoke script but what is the c# to detect the event? Thanks :)

Did you try using the Holding event attribute of the UI element?

http://msdn.microsoft.com/en-US/library/windows/apps/windows.ui.xaml.uielement.holding

Hope it helps!

You should invoke script in WebView for binding gesture event in javascript first. Read this: MSGestureHold | onmsgesturehold event

Then you should use window.external.notify in the MSGestureHold event handler above to notify your WebView that Hold event is triggered.

But WinRT 8.1 WebView is disabled scriptnotify in non-certificated websites (read the remarks), so you should find a solution to fix this issue. Here is my solution.

Or you can download my demo directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM