开发者

WebBrowser disable copy paste

I have a several question about WebBrowser control into WP7.

  1. How to disable word selection by a click?
  2. How to di开发者_运维问答sable vertical scrollable by a gesture?


Add some extra styles to your html pages and render it on WebBrowser control

  1. body {-ms-user-select: none;} use this css code to disable word selection by tap in IE on Windows phone 7/8

  2. body {-ms-touch-action: none;} use this css code to disable vertical scroll

    in IE on windows phone 7/8

hope this work fine for you.


first , u can get a border control which is the container of the ie9 mobile core using visual tree helper

then

Q1: u can cancel the "Tap" gesture occurred in border control before it was passed to ie core

Q2: u can cancel the "DragDelta" gesture for some direction or distance ,well ie. vertical scroll.


The answer to Copy and Past = "I don't believe you can stop it from occurring, unless its your webpage and you can set it up for a Read Only Document."-If i am wrong please correct me.-

the answer to Vertical Scrollable By a Gesture = "You could build the Gesture to Return a Null instead of the event value, Pretty much tell it that if this occurs then Cancel it....Return Nothing!"


You can achieve disabling selection using javascript:

function DisableSelect() { var handler = function (e) {e.returnValue = false;} document.body.attachevent('onselectstart',handler,false);}

and than calling from your code:

wb.InvokeScript("DisableSelect");

Don't forget to detach the event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜