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

191
Vistas
How do I use custom javascript through amp-script?

Not a seasoned programmer but getting a handle on javascript, css, html. I have been successful in creating and loading javascript to use in my standard HTML files. I would like to start using AMPHTML and need to use my own JavaScript for some interaction. Are there some concrete stem-to-stern examples out there? Google AMP's own documentation leaves much to be desired for the uninitiated.

  1. I have reviewed the documentation, written my code (passing AMP verification before using amp-script.
  2. Supposedly, I have imported my javascript per the method shown in the documentation. I do not understand what the width and height attributes are there for, or what layout container or fixed has to do with anything.
  3. Going by the AMP documents and checking Source in the Development Tools, my file blogHub.js has been accessed and loaded. I see the file there as mentioned and that supposedly means I can use those functions...

So now, I am trying to see some signs of life from my javascript by trying to run functions which spit out console.log messages, but I see nothing. No doubt this is a simple problem for many, but it has me stumped for the moment.

Is sandwiching the relevant code between the tags a way to corral a separate section away from the rest of the AMP environment or the rest of the DOM?

My desire is to write javascript code which will bring in a .csv file containing information of past blog posts, then update the blog page with this information, then allow the selection of these articles for display in the amp-iframe. It should not be necessary to go into all of that code written or unwritten. I just need to know how to begin using my own javascript from within and AMP document. I am only using Vanilla JavaScript as I am not up to using any of those other libraries at this point. There should not be a need to do so, in any case.

A link to my "sandbox" early version of the page I am working on is found here -- https://michaelsbookcorner.com/HTML-blog/blogFiles/AXX-blogHub.html

about 4 years ago · Juan Pablo Isaza
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