Closed (fixed)
Project:
Colorbox Node
Version:
7.x-2.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Aug 2012 at 07:45 UTC
Updated:
10 Jul 2013 at 04:29 UTC
Hello, great module guys. One problem though: Colorbox Node is unfortunately filtering out script tags from nodes for some reason.
I'm not sure if it's a bug or some kind of protection. However, I really need that script tag on one of my nodes. Is there any way to include javascript with nodes?
Thank you. :)
Comments
Comment #0.0
stompeduns commentedGrammar.
Comment #1
iLLin commentedIt doesn't strip out script tags. I have successfully put javascript into my node template and it fires just fine. Make sure you wrap what ever your trying to execute into an onready event.
Comment #2
stompeduns commented@iLLin, I did it like this:
Not working :(
EDIT: Wait code actually did execute, I tried a little "alert" and it ran just fine. It must be something in my code then. I think global variables shouldn't be in or outside the $.ready event. It causes trouble for some reason.
Comment #3
iLLin commentedTry this in your node template.
If that works, maybe you have a timing issue and you could try using
setTimeoutComment #4
stompeduns commented@iLLin, it actually turns out to be a timing issue! But how come? I put my script at the bottom of the node, it should load right after all other elements. Colorbox seem to be rearranging the elements from the node.
Comment #5
iLLin commentedThis module will load the contents of the ajax callback into a dom element on the page. It will then "move" that data into a colorbox "inline" style. Only way I could find to do this as colorbox doesn't interpret the json request as drupal does.
I have another idea to change this behavior but haven't had time to try it out. It will go hand in hand with the "loading instead of throbber" stuff I have been working on thats currently in DEV.
Comment #6
stompeduns commented@iLLin, great I'll be waiting for a new realese. :)
Meanwhile, I'll be using setTimeout (which surprisingly worked pretty good).
Comment #7
patrickroma commentedSame issue here... How to display google adsense in a colorbox node?
Comment #8
iLLin commentedchanged more stuff up around this in the next DEV release, hopefully you shouldn't need to use setTimeout anymore.
Comment #9
stompeduns commentedAwesome, thank you!
Comment #11
jglynn commentedI'm trying to add the google adwords conversion javascript to a webform confirmation page that is in a colorbox node.
I've added the javascript to the webform-confirmation.tpl.php, and it works fine on a normal webform page, but in a colorbox node the javascript tags are stripped out.
Is there anyway around this?
Comment #12
iLLin commentedAre you sure they are stripped out? Are you sure the webform-confirmation.tpl.php is used? Try installing the latest dev version 3.x-dev and then use the webform ajax module to make webforms AJAX. See if that will work for you.
Comment #13
b3nji commentedHow do we use setTimeout?
Comment #13.0
b3nji commentedChanged
to script.