Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a self hosted Wordpress 3.7 and using the Twenty Thirteen theme. I have placed a text widget on the sidebar and put a simple code from Amazon inside it:

<SCRIPT charset="utf-8" type="text/javascript" src="http://ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fguardiaintern-20%2F8002%2Feb678005-711d-488e-bdc6-f6dd775e0ed8"> </SCRIPT> 
<NOSCRIPT><A HREF="http://ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fguardiaintern-20%2F8002%2Feb678005-711d-488e-bdc6-f6dd775e0ed8&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>

However, when you load the site, it doesn't show up. I was under the impression that any arbitrary text or html would also include <SCRIPT> code as well and yet it seems to not be the case. Does anyone knows what's wrong or how to fix this?

Additional UPDATE: It turns out that the code above shows up in Firefox and IE with a slight delay but it does render. However, it will NOT render on Chrome at all, no matter what. Any idea why it seems/appears on the surface at least to be browser specific? What would cause that difference in behavior?

DEBUGGING RESULTS: It is found that indeed it IS a Wordpress BUG that is causing the code to break. Using @toscho recommended plugin Magic Widgets has resolved the issue making the code display without issue. I will be in touch with the WP developers Ryan and Andrew to figure out what is causing the issue and resolve the bug in the next release to avoid future issues of the same nature.

share|improve this question
2  
Do you mean that nothing prints to the screen (you will have to look at the source of the page to see it) or that the script doesn't work? –  s_ha_dum Oct 26 '13 at 22:02
    
@s_ha_dum, yes what I mean is that it is not painting out on the screen when the page is loaded. Checking the source of the page the code above is pushed but not displaying. I have traced the source of the link its pulling, its a script and that also pulls a backend code. It has been tested by Amazon and they say its showing up on their test system, but not on mine. I don't understand why though, it should process and show it. I have tried to put the raw code in <SCRIPT> tag and it just dumps the text of the script, not the rendering. –  GµårÐïåñ Oct 27 '13 at 4:02
1  
Your problem is an issue between Chrome and the Amazon code. It is not WordPress specific. You can try the Unfiltered Text Widget from Magic Widgets to make sure WordPress doesn’t change the code. –  toscho Oct 30 '13 at 9:42
    
@toscho, Thank you for that, I will take a look at the suggestion and see how it changes anything. I doubt WP is changing anything since I have run a raw debug of the code/output and so on and it is passed unchanged. Amazon claims that it works on Chrome, they have tested it but I am doubtful they are telling me everything. I have used wordpress since 1.9 and I consider myself very proficient since I have done many sites, so I am trying to narrow it down, if its a bug in WP then I need to reach out to Ryan or Andrew so we can bug track and bust it. –  GµårÐïåñ Oct 30 '13 at 18:33
1  
It isn't a bug. The Core Text Widget isn't intended for completely unfiltered script content. –  Chip Bennett Oct 30 '13 at 20:05

1 Answer 1

up vote 0 down vote accepted

[SUMMARY]

Although in theory, using the core provided Text Widget should allow you to put any arbitrary HTML code into action, I recently encountered the issue above where the code was wrapped by Wordpress in such a way that affected the ability to render properly on Chrome. The code still showed up fine on Firefox and Internet Explorer but the problem affected Chrome sufficiently that it would not display correctly (would show up blank/no output rendering).

[SOLUTION]

After looking at the core code and evaluating the "final" code that Wordpress is pushing out, I realized that it has to do with the way it affects the element's generated by code from being accessed by the Chrome mechanism for rendering. Removing those added wrappings that caused the issue from the final code resulted in displaying correctly. This process was further automated and verified repeatedly by using a plugin suggested by @toscho called Magic Widgets that provides you with an Unfiltered Text Widget that processes the code pasted in them in their pure form and without and processing or wrapping done by Wordpress.

[CONCLUSION]

My conclusion and recommendation to everyone is that until such time as I can get the Wordpress developers to provide a better Text Widget that doesn't interact with the code in anyway, you should use the above mentioned Plugin for putting any raw codes, particularly <SCRIPT> codes or anything that pulls JavaScript code from the system (like the above example in my question) so that you avoid any interference with the way it is processed and rendered by Wordpress - short of editing the pages manually and putting your code directly in the files you will be displaying.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.