MyBB Community Forums

Full Version: Enable Javascript in a MyCode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I enable javascript in a MyCode?
I am trying to add Chitika ads in a post through MyCode

<script type="text/javascript">
  ( function() {
    if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; };
    var unit = {"calltype":"async[2]","publisher":"ygrkqce","width":468,"height":60,"sid":"Chitika Default"};
    var placement_id = window.CHITIKA.units.length;
    window.CHITIKA.units.push(unit);
    document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>');
}());
</script>
<script type="text/javascript" src="//cdn.chitika.net/getads.js" async></script>

Best Regards,
My guess it would be the same way you would do html.
(2014-07-20, 12:45 PM)Ace700 Wrote: [ -> ]My guess it would be the same way you would do html.

thanks for your response but when i enter above code in MyCode replacement it shows nothing in the forum.
You will likely need to do core modifications where MyBB filters script tags. One such file would be /inc/class_parser.php and search for <s(cript, however doing so can open security issues for your board. An alternative (and I think there are plugins that do this, if not in MyBB, then other software) is to implement them through the templates.

Ultimately, the question is more or less, what is the goal you wish to achieve for adding the ads? (besides generating revenue for your site/forum). How often do you want the ads to appear, or are you attempting to add it to your (or a bot's, maybe?) signature on your board? Those type of questions.
Thanks All for response, I think <script> tag is not working in MyCode thats why I am unable to add chitika and jw player 6 through a mycode, anyways; i am no longer interested to implement both of them in my forum.
Best Regards,