Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.2k views
in Q2A Core by

How can i add text/javascript to all sites/subsites?


I have to add it to every page Q&A:

<script type="text/javascript" src="whcookies.js"></script>

1 Answer

+2 votes
by
selected by
 
Best answer
Admin ---> Layout ---> "custom HTML at <your position>"
by
So your code has been successfully added to your pages ... (your question).
What were you expecting to see ?
by
Join to my website:
http://askingleague.ct8.pl

At top u can see note "Ta strona używa ciasteczek (cookies), dzięki którym nasz serwis może działać lepiej. Dowiedz się więcej"

Please enter deeper into the site. Click for example tags, users or something.
Information which you see on the main page at the top - disappeared! ("Ta strona używa ciasteczek (cookies), dzięki którym nasz serwis może działać lepiej. Dowiedz się więcej")
by
Ok,
below my comments :

1) I notice that the statement :
<script type="text/javascript" src="whcookies.js"></script>
is included 3 times in every page.
It should be added only 1 time.
I think you're adding it (2 times) from an advanced theme head_script function, aren't you ?
(1 time is added as I told you above)
Include it only 1 time.

2) I see that you have placed the js in your doc root.
Include it using this syntax :

<script type="text/javascript" src="/whcookies.js"></script>

it should work with the URL scheme that you have adopted ( "/index.php/123/why-do-birds-sing")
by
My god...! One stupid tag "/".
Now everything works as it should.
Thank you for your willingness, wasted time and help. Really!
...