我想禁用查找功能。我有一個文本上去,用戶shuld讀取全文沒有祕籍,如CTRL + F。我已經禁用了CTRL + F。 但我可以從瀏覽器菜單中打開查找欄。是否可以禁用網頁上的查找功能,而不僅僅是CTRL + F?
我希望有人有一個想法。
我想禁用查找功能。我有一個文本上去,用戶shuld讀取全文沒有祕籍,如CTRL + F。我已經禁用了CTRL + F。 但我可以從瀏覽器菜單中打開查找欄。是否可以禁用網頁上的查找功能,而不僅僅是CTRL + F?
我希望有人有一個想法。
您可以根據您的文字在JavaScript庫html2canvas上飛行刪除圖像。例如,如果你想與ID docs
成圖像變換格,你的代碼將
$(document).ready(function(){html2canvas($('#docs'), {
onrendered: function(canvas) {
$('#docs').html(canvas);
}
});});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<div id="docs">This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.</div>
附:但用戶仍然能夠看到文本,如果他將檢查頁面的HTML
這不是一個真正的答案你的問題,但這裏更好。
只需在文字中加上一個空格,即不應該搜索並且隱藏該空白。 例如:
<p>"This is a te<span class="foo"> </span>st."</p>
和CSS:
.foo{
font-size:0;
}
https://jsfiddle.net/y8g10jsr/
嘗試使用CTRL + F搜索 「測試」
我只是嘗試這樣做的解決方法,它似乎呈現文本不可測量。
.overlook::after {
content: attr(data-text);
}
<p class="overlook" data-text="Ctrl+F will not find this">
測試在Chrome,Firefox和IE。
編輯:
哦,我還沒有看到這個問題下面的評論 - 請了投票original如果你發現這很有用。
我的想法是永遠不要這樣做。 – evolutionxbox
將文本轉換爲圖像 – inarilo
@inarilo或將其嵌入爲SVG路徑。 – evolutionxbox