Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Cómo mostrar la URL actual dentro de la inserción

<embed src="snippet.html"> - Necesito insertar la URL personalizada (otrositio.com/directorio/algo/) + "parte de búsqueda" de la URL actual dentro del atributo src. Entiendo que algo como "console.log(window.location.search)" puede ayudar, pero ¿cómo podría conectar/insertar eso para que esté dentro de src?

En resumen, la salida de mi código incrustado debería verse así: <embed src="othersite.com/directory/something/astalavista"> , cuando la URL actual se ve así mysite.com/info/astalavista

¿Cómo debería verse mi código HTML?

Yo uso Wordpress. Necesita código HTML. Gracias.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Prueba esto

 const loc = new URL(location.href); const lastPath = loc.pathname.split('/').pop(); const embed = document.createElement('embed'); embed.src = `https://othersite.com/directory/something/${lastPath}` document.body.appendChild(embed)
about 4 years ago · Juan Pablo Isaza Report

0

Si desea hacerlo en su lugar en su HTML, tal vez no sea el mejor JS, pero puede hacerlo:

 some of your html... <script> let myUrl = "whatever"; // or echo some php variable here? window.write(`<embed src="snippet.html/${myUrl}">`); </script> carry on with your html...
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!