External Content in Blogger Post


  • pull content from 3rd party source, using crossorigin.me (CORS proxy) to avoid “no ‘access-control-allow-origin’ header is present on the requested resource”
  • from what i can glean, Blogger does not offer any kind of server side include facility so we have to resort to client browser tricks and that means this content is NOT going to be crawled/googlable
  • this approach relies on jQuery (Core) so you’ll need to have that referenced as well – example here, but also make sure you point at the latest version

drop this helper function in a global JS/HTML widget via the Blogger Layout editor…

function pluginContent(url, containerSelector, boolPrettyPrint) {
  var ctrl = $(containerSelector);
    .done(function (result) {

        //force prettyPrint rendering after loading dynamic content
        // google on: "google code prettify" to get dialed in on this code syntax highlighting library
        // => https://code.google.com/p/google-code-prettify/wiki/GettingStarted
        if (boolPrettyPrint) {
    .fail(function() {
      ctrl.html('failed to retrieve external content.'+
        'try going there directly: <a href="'+url+'">'+url+'</a>')

Then use it like this in an individual blogpost:

<pre class="prettyprint linenums lang-powershell" id="prePoshDualExplorers"></pre>

  //pull code content from codeplex
  pluginContent("https://beejpowershell.svn.codeplex.com/svn/PoshDualExplorers/PoshDualExplorers.ps1", "#prePoshDualExplorers", true);

Leave a Reply