Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

JS realizes copying web page content and automatically adding copyright content code and original text link.

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Var Sys = {}; var ua = navigator.userAgent.toLowerCase (); if (window.ActiveXObject) {document.body.oncopy = function () {event.returnValue = false; var t=document.selection.createRange (). Text; var s = "original link:" + location.href; clipboardData.setData ('Text',t+'\ r\ nlinks);} } else {function addLink () {var body_element = document.getElementsByTagName ('body') [0]; var selection; selection = window.getSelection (); var pagelink = "original link:" + location.href; var copytext = selection + pagelink; var newdiv = document.createElement (' div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px' Body_element.appendChild (newdiv); newdiv [XSS _ clean] = copytext; selection.selectAllChildren (newdiv); window.setTimeout (function () {body_element.removeChild (newdiv);}, 0);} _ document.oncopy = addLink;}

Copy the above code in the html file and paste it in front of the / body code

Gathering network

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report