Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
tampermonkey script to open website doesnt work

I use this script to open a specific link in a div of a webpage:

     // ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.tampermonkey.net/index.php?version=4.13&ext=dhdg&updated=true
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
 // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==

 $(document).ready(function()
                   {
let url = $(".cta-button-container__item").attr('href');
    window.location.href = url;
});

the inspect elements for the link in the page is:

<div class="cta-button-container__item">
                    <a href="/content/pdf/xxxx.pdf" title="Download this book in PDF format" target="_blank" rel="noopener" class="c-button c-button--blue c-button__icon-right test-bookpdf-link" data-track="click" data-track-action="Book download - pdf" data-track-label="">
                        <svg width="12" height="14" viewBox="0 0 12 14" xmlns="http://www.w3.org/2000/svg"><path d="M7 7.269v-6.271c0-.551-.448-.998-1-.998-.556 0-1 .447-1 .998v6.271l-1.5-1.547c-.375-.387-1.01-.397-1.401-.006l.016-.016c-.397.397-.391 1.025-.001 1.416l3.178 3.178c.392.392 1.024.391 1.415 0l3.178-3.178c.392-.392.391-1.025-.001-1.416l.016.016c-.397-.397-1.018-.388-1.401.006l-1.5 1.547zm-7 5.731c0-.552.456-1 1.002-1h9.995c.554 0 1.002.444 1.002 1 0 .552-.456 1-1.002 1h-9.995c-.554 0-1.002-.444-1.002-1z" fill="#fff"></path></svg>
                        <span>Download book PDF</span>
                    </a>
                </div>

Unfortunately tampermonkey says no script is running.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

after more search and i edited the script and it works perfectly:

    // ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://link.springer.com/book/*/*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
 // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==

 $(document).ready(function()
                   {
    let url = $(".cta-button-container__item a").attr('href');
    window.location.href = url;
});

I forgot to add the a which is equivalent to .find("a") . I changed the url of the filter to https://link.springer.com/book/*/*. the (/) just means any address beginning with the previous link.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda