复制网页内容 - 禁用 [英] Copying Web Page Content - Disable

查看:64
本文介绍了复制网页内容 - 禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在浏览网页时,用户可以在

a页面上突出显示内容(通过按住鼠标左键并拖动鼠标

超过所需内容)。有没有办法禁用此选项?我b $ b假设我不得不尝试。

解决方案

Matt写道:< blockquote class =post_quotes>浏览网页时,用户可以在页面上突出显示内容
(通过按住鼠标左键并将鼠标拖动到所需内容上)。有没有办法禁用此选项?我承认我不得不尝试。




这听起来很不祥。无论如何...


<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 // EN"

" http:/ /www.w3.org/TR/html4/strict.dtd">

< html>

< head>

< ; script type =" text / javascript">


if(''undefined''!= typeof document.onselectstart)

{

document.onselectstart = function()

{

返回false;

}

}

else

{

document.onmousedown = function()

{

返回false;

}

document.onmouseup = function()

{

返回true;

}

}


< / script>

< / head>

< body>

< p>

浏览网页时,用户可以突出显示内容


a页面(按住鼠标左键并拖动鼠标

超过所需的co ntent)。有没有办法禁用此选项?我承诺没有,但我必须尝试。

< / p>

< / body>

< / html>


在针对用户的无休止战争中的又一章。


< blockquote> Matt写道:

浏览网页时,用户可以在页面上突出显示内容(通过按住鼠标左键并拖动鼠标
期望的内容)。有没有办法禁用此选项?


不,但有些人可能会让你相信不然。他们也可能会让你相信你可以禁用鼠标按钮,但是你也不能这样做。

我假设那里我不得不尝试。




你的假设是正确的。

-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组周刊


Matt写道:

浏览网页时,用户可以突出显示页面上的内容(按按住鼠标左键并将鼠标拖动到所需的
内容上。有没有办法禁用此选项?我承认我不得不尝试。




一般来说,没有。 IE提供了一个 - onselectstart - 可以取消
的事件,任何将选择本身暴露给脚本的浏览器

应该允许清除该选择。接近这两者都依赖于客户端脚本的

,可以单独禁用,也可以通过

禁用浏览器上的脚本来禁用。也不会做任何事情来阻止页面内容的复制,因为还有很多其他方式可以做到这一点,无论如何,拖动选择只是直接和明显的

方法。


取消/清除选择可能有其他原因,例如

避免不良视觉假象,例如,动画

鼠标拖动任意绝对定位的页面元素作为GUI的一部分。


Richard。


When browsing a web page a user has the ability to highlight content on
a page (by holding down the left mouse button and dragging the mouse
over the desired content). Is there a way to disable this option? I
assume there isn''t but I have to try.

解决方案

Matt wrote:

When browsing a web page a user has the ability to highlight content on a page (by holding down the left mouse button and dragging the mouse
over the desired content). Is there a way to disable this option? I
assume there isn''t but I have to try.



That sounds ominous. Anyway...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">

if (''undefined'' != typeof document.onselectstart)
{
document.onselectstart = function()
{
return false;
}
}
else
{
document.onmousedown = function()
{
return false;
}
document.onmouseup = function()
{
return true;
}
}

</script>
</head>
<body>
<p>
When browsing a web page a user has the ability to highlight content on

a page (by holding down the left mouse button and dragging the mouse
over the desired content). Is there a way to disable this option? I
assume there isn''t but I have to try.
</p>
</body>
</html>

Yet another chapter in the endless war against the user.


Matt wrote:

When browsing a web page a user has the ability to highlight content on
a page (by holding down the left mouse button and dragging the mouse
over the desired content). Is there a way to disable this option?
No, but some people may lead you to believe otherwise. They may also
lead you to believe you can disable the mouse buttons but you can''t do
that either.
I assume there isn''t but I have to try.



Your assumption is correct.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly


Matt wrote:

When browsing a web page a user has the ability to
highlight content on a page (by holding down the left
mouse button and dragging the mouse over the desired
content). Is there a way to disable this option? I
assume there isn''t but I have to try.



Broadly no there is not. IE provides an - onselectstart - event that may
be cancelled, and any browser exposing the selection itself to scripts
should allow that selection to be cleared. Both approached are dependent
on client-side scripting and can be disabled, either individually or by
disabling scripting on the browser. Neither will do anything to prevent
the copying of page content, because there are so many other ways of
doing that anyway, drag selection is just the immediate and obvious
approach.

Cancelling/clearing selections can be useful for other reasons, such as
avoiding undesirable visual artefacts while, for example, animating the
mouse dragging of an arbitrary absolutely positioned page element as
part of GUI.

Richard.


这篇关于复制网页内容 - 禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆