First time here? Check out the FAQ!
0

How to paste custom javascript at one question only?
 

Is it somehow possible to paste some custom javascript on one specific question only?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Toms's avatar
767
Toms
asked 11 years ago

Comments

see more comments

1 Answer

1

In the template question/javascript.html you could add something like:

{% if request.path == '/my-url/' %}
<script src="http://example.com/script.js" />
{% endif %}

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 11 years ago, updated 11 years ago
link

Comments

Some agency wants to test my site to be approved by their standards and they want me to paste their code on one test-question-page. If I paste it for all sites, it will eventually break the site for one day.

Toms's avatar Toms (11 years ago)

Thank you! It works!

Toms's avatar Toms (11 years ago)
see more comments