Hello. I'm using CKEditor for Wordpress 4.0 and Wordpress 3.8 running Sandbox 1.6.2
Problem: When I paste asynchronous adsense code in the CKEditor's 'source' mode, it appears fine and works fine when the page is viewed. However, when I save the page, or switch from 'visual' and then go back to 'html', the code gets shortened (and consequently no ad is displayed when the page is viewed).
The problem goes away if I disable CKEditor for wordpress. Note that I also have WPAutop plugin installed.
======== Async Adsense code from google (I removed my Adsense ID):
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Under_Header_Ldrboard -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="XXXXXX"
data-ad-slot="XXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
============== Screwed up code after saving:
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- Under_Header_Ldrboard --><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</p>
=======
As you can see, the code in the <ins></ins> tag is removed.
I have tried reformatting the code so there are no spaces, and changing the double-quotes to single quotes, to no avail. I've also tried changing "//pagead2" to "http://pagead2" but it didn't help.
Lastly, the synchronous adsense code works fine with CKEditor. It's just the Async code that doesn't.
After Googling around, I found someone who suggested turning off the "Advance Content Filter" in CKEditor for a similar problem. I have not tried this yet, as it's not a simple option in the plugin's config, but requires me to edit a value in the plugin's config somewhere. Is this what is required to get Adsense code to work with CKEditor?
Any insight would be appreciated.
MB / www.englishcurrent.com
CKEditor removes scripts.
CKEditor removes scripts. Maybe use the protectedSource function?
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Thanks. Based on another
Thanks. Based on another thread (http://drupal.stackexchange.com/questions/97686/how-do-i-prevent-ckeditor-4-from-stripping-google-adsense-asynchronous-tags ), I added this line:
It did nothing, though. ;\ . If CKEditor removes scripts, why would it allow the synchronous script (and not the async one)? It seems to just have a problem with the <ins> tag.
Let me know if you have further suggestions.
MB
fixed
It's working. I added this code to the config file:
config.protectedSource.push( /<ins[\s|\S]+?<\/ins>/g); // Protects <INS> tags
Yay
Cool, thanks for sharing!
Cool, thanks for sharing!
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
I have exactly the same
I have exactly the same problem , and nothing helps; nothing at all; and why I should beat my head against the wall for hours, because somebody has invented some unnecessary striping?!
I have all -
config.allowedContent = true;
config.protectedSource.push( /<ins[\s|\S]+?<\/ins>/g); // Protects <INS> tags
config.protectedSource.push( /<ins class=\"adsbygoogle\"\>.*?<\/ins\>/g );
- and still - all my Adsense code is striped each time!
what else to do?
I'm using Drupal 7 with CKeditor ....
I have exactly the same
I have exactly the same problem and I also use Drupal 7 with CKEditor. My other website www.itp-interpipe.com faces no problem (but not on the same distribution therefore not comparable). I am also stuck, what to do?