Friends,
I’m creating a website with a page builder, and I share some cookies on it.
I tried to create this code so that users can more easily copy and paste the cookie.
However, I can only copy the first few characters of the cookie.
Look at the pictures, I don’t know where I’m going wrong.
Sorry, I’m new to this area.
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="footer.css" />
<title>Javascript - Copy to Clipboard</title>
</head>
<body>
<input
type="text"
name="texto"
id="texto"
readonly
placeholder="Digite alguma coisa"
value=`
"[
{
{
[ {
"domain": "teste.pro",
"hostOnly": true,
"httpOnly": false,
"name": "wordpress_test_cookie",
"path": "/",
"sameSite": null,
"secure": false,
"session": true,
"storeId": null,
"value": "WP%20Cookie%20check"
},
{
"domain": "teste.pro",
"expirationDate": 1708729370.70298,
"hostOnly": true,
"httpOnly": false,
"name": "wp-settings-time-1",
"path": "/",
"sameSite": null,
"secure": true,
"session": false,
"storeId": null,
"value": "1677193564"
}
]
"
` />
<button onclick="copiarTexto()">Copiar</button>
<script>
function copiarTexto() {
let textoCopiado = document.getElementById("texto");
textoCopiado.select();
textoCopiado.setSelectionRange(0, 99999);
document.execCommand("copy");
alert("O texto é: " + textoCopiado.value);
}
</script>
<div class="footer" id="footer"></div>
<script src="footer.js"></script>
</body>
</html>
i want to be able to copy all the cookie
I want to be able to copy the entire cookie, not just those first few characters.
2
Answers
Thank you all for your attention, the problem was simple, I put the single quotes and it worked normally.
Is there any way to extract the "value=" from another external location? For example.
I have a text in OneDrive in txt, I want the "value" to extract the information from that text.