Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
W Wiki
  • Project overview
    • Project overview
    • Details
    • Activity
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
Collapse sidebar
  • Tutoriais
  • Wiki
  • Wiki
    • Plugins
  • Adicionar informações extras ao texto copiado da web

Last edited by Tainã de Souza Aug 19, 2020
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Adicionar informações extras ao texto copiado da web

``Esse é um .JS que tem como objetivo adicionar um texto ao conteúdo copiado da internet.

O mais simples e atual sendo utilizado (2020).

Solução que funciona em todos os navegadores recentes.

`function addLink(event) { var pagelink = 'Para compartilhar esse conteúdo, por favor utilize o link: ' + document.location.href; //event.clipboardData.setData('text', document.getSelection() + pagelink); Aqui vem com o texto selecionado junto event.clipboardData.setData('text', pagelink); event.preventDefault(); }

document.addEventListener('copy', addLink);`

FONTE COM OUTRAS OPÇÕES MAIS ANTIGAS: https://stackoverflow.com/questions/2026335/how-to-add-extra-info-to-copied-web-text/4777746#4777746

Clone repository
  • Gitlab
    • Comandos
  • Hotfix
    • og:image
  • Magento
    • Htaccess
    • MagentoCronChecker
    • Robots
    • SimpleSchema
    • Soap v2 Tester
    • gitignore
  • Migração
    • leg.br
  • Padrões
    • eslint
    • prettier
  • Plugins
    • Adicionar informações extras ao texto copiado da web
  • QueryCommerce
  • Servidores
    • Cloudways
    • DnsMadeEasy
View All Pages