Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

js 如何禁止浏览器的拖动搜索

现在页面上有一个拖拽功能, 但是目前绝大部分浏览器都会有一个拖动然后新增一个tab的搜索页,
请问, 不用浏览器的设置, 能否实现禁止浏览器这个行为 ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

text 这个key 替换成任意字符即可

target.dataTransfer.setData("text", e.target.innerHTML)
target.dataTransfer.setData("abcd", e.target.innerHTML)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...