Cocoa WebView, WebKit - Prevent I-Beam cursor from showing over text?

折月煮酒 提交于 2019-12-10 23:16:47

问题


Cocoa app, SnowLeopard

I have a WebView in to which I'm loading HTML (essentially for application UI purposes).

In the html, I've added:

<body onselectstart="return false" ondragstart="return false">

This prevents text from being selected, which is what I want for this job.

However, whenever the cursor is moved over any text, including disabled "button" texts, the cursor changes to the I-Beam, producing a nasty, unwanted effect.

Is there any way to change this behaviour, either in HTML or in WebKit?

Thanks for any help.


回答1:


Try adding the -webkit-user-select: none; declaration to each of the selectors you don't want to be user-selectable.

Actually, if you just want to show a different cursor, use this:

#myelement {
    cursor: default;
}

This will show a regular pointer instead of the selection I-Beam.



来源:https://stackoverflow.com/questions/3464111/cocoa-webview-webkit-prevent-i-beam-cursor-from-showing-over-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!