Cocoa WebView, WebKit - Prevent I-Beam cursor from

2019-07-16 06:02发布

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条回答
啃猪蹄的小仙女
2楼-- · 2019-07-16 07:07

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.

查看更多
登录 后发表回答