gravityboy
gravityboy

Reputation: 817

FireFox code not working

is there any reason why firefox might not display this code below? It works in every other browser and creates the comments

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript';  
    dsq.async = true;
    dsq.src = 'http://sample.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || 
     document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

p.s. if there isn't anything obviously wrong with the code with respect to firefox it must be something else and I'll keep digging. I was thinking maybe they don't recognize one of the tags or something? But I guess they do.

Upvotes: 0

Views: 296

Answers (2)

Spiny Norman
Spiny Norman

Reputation: 8327

Here is an example: http://www.phpied.com/javascript-include-ready-onload/ that uses setAttribute instead of dot notation properties. Maybe that is what Firefox wants? (haven't tried this)

Upvotes: 0

pooja
pooja

Reputation: 2422

use this way.

<script type="text/javascript">
(function() {
var dsq = document.createElement('script');  
    dsq.async = true;
    dsq.src = 'http://sample.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || 
     document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>

because its compatible with all browser.

Upvotes: 1

Related Questions