locked
Windows Live Writer breaks Google Adsense Code. Any fixes or solutions? RRS feed

  • Question

  • Hi, 

    when i add Google adsense code in the HTML Source code (Shift+F11) and switch to the HTML View (F11) and then back to the Sourcecode View (Shift+F11) the google code is broken and looks like

    <div style="float: left"><script type="text/javascript">
    <!--
      google_ad_client = "pub-xxxxxxxxxxxxxxx";
      google_ad_slot = "497xxxxxx";
      google_ad_width = 120;
      google_ad_height = 240;
      //-->
      </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">

      </script> <--- Googlecode ends here

    and this gibberish ____ gets added after switching back and forth

    <iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-xxxxxxxxxxxxxxx&amp;dt=1233899995078&amp;lmt=1233899994&amp;output=html&amp;slotname=497xxxxxx&amp;correlator=1233899995078&amp;url=file%3A%2F%2F%2FC%3A%2FTemp%2FWinTemp%2FWindowsLiveWriter1286139640%2F69F9B06B1584%2Findex.htm&amp;eid=6083028&amp;ea=0&amp;frm=0&amp;ga_vid=1018486710.1233899996&amp;ga_sid=1233899996&amp;ga_hid=284866389&amp;u_h=1050&amp;u_w=1680&amp;u_ah=1020&amp;u_aw=1680&amp;u_cd=32&amp;u_tz=60&amp;u_java=true&amp;dtd=468" frameborder="0" width="120" scrolling="no" height="240" allowtransparency="allowtransparency"></iframe></div>

    And this breaks the layout and uploade posts. Any fixes or workarounds?

    Friday, February 6, 2009 6:08 AM

All replies

  • This is probably because the WYSIWYG editor is actually just a browser, and it is probably executing the javascript, at least partially.

    You might have some options, what blogging service are you using?
    -Brandon Turner [MSFT]
    Saturday, February 7, 2009 1:15 AM
  • Thanks for replying. 

    I'm using Google's Blogger. The error seems to occur becuase the HTML View downloads the "external" Code which displays the actual advertisment, but when you jump back to Source View it includes the code of the advertisment. Can't you implement a feature which will won't save back the downloaded content (i.e. Advertisements), as there is no point in saving stuff which was downloaded in a iframe or via javascript. Other wise it gets very complicated to implement javascript inside the blog posts (like a Digg-Button)

    Saturday, February 7, 2009 9:01 PM
  • As far as I know, we don't have a very compelling reason to enable or disable javascript execution.  I would say this is probably the best reason I have heard for us to disable it.  Going forward, I will keep this in mind.

    For the time being, there are 2 things you could do.  The first is you could make pre-publish Windows Live Writer plugin to go inject this javascript every time you publish, the downfall of this that it be limited in where you can insert it.

    The 2nd thing you could do it, is right before you publish, go to source mode, paste in the javascript, but click publish before going back to the WYSIWYG mode.


    -Brandon Turner [MSFT]
    Monday, February 9, 2009 5:34 PM
  • I looked into this more.  We have code to handle this already, and one of its purposes it for google ads directly.  It didn't get added until a more recent version of WLW.  Can you tell me what version of Windows Live Writer you are using? Help | About shows the version number.
    -Brandon Turner [MSFT]
    Wednesday, February 11, 2009 1:39 AM
  • Hi,

    sorry for replying so late. I'm still using version 12.0.1370.325. I already tried to install the 14.x version, but for some reason it failes to install. Will try it again later.

    btw. it's great peice of software and is really usefull when blogging and i love it! Keep it up :)

    P.S. Dunno if it's already in, but is it possible to automatically make all links "nofollow" with exception of a few defined ones on a whitelist? (or having blacklist of domains, which will be automatically nofollow by default unless changed manually?

    Saturday, February 14, 2009 2:02 AM
  • Let us know if the install fails again, we might be able to help with that as well.

    There's no built-in way to make all links nofollow. For doing it manually, though, did you notice the Insert Hyperlink dialog has an Advanced section that lets you set the rel?

    Just curious, why do you want all links to be nofollow?
    Monday, February 16, 2009 6:41 PM
  • I've tried it again. For some reason the first time i start the installation, it fails and tells me that it couldn't connect to the servers. But after i start it a second time, it worked. I like the new 14.x Version very much!

    Yea, i noticed the advanced section when creating a link before, but some times i forget this, when i'm adding many links.

    The reason for an "blacklist" of certain domains is because of SEO and page rank. There are some big websites, which abuse the nofollow rel-attribute so they don't have to give anything of their pagerank to sites which are linked from their websites. For example http://www.wowhead.com/ or http://www.youtube.com/ or some blog directories and other similar websites.

    So, if i have normal links on my blog leading to http://www.wowhead.com/ or http://www.youtube.com/ then this pages would get a small amount of my page rank to increase theirs (higher page rank = better search results in Google for example). If someone would post a link on one of this two pages to my website, i wouldn't receive any pagerank in return. So their page rank would grow further while mine would stay same or even get lower.

    And as the pagerank contribution also depends on the number of links on a page (internal and external), this can heavily effect your own page rank if you have many links, especially in case of http://www.wowhead.com/ as i often post guides and tutorials for World of Warcraft and use Links to wowhead, for the item and skill descriptions (and also a nice mouseover feature when you hover over the item link which points to wowhead) and makes it much easier for my readers to get the necessary information. Depending on the post, there can be up to 20-30 links pointing to different World of Warcraft skills on wowhead.com and this can have a big influence on my pagerank and manually inserting nofollow for every single link is quite much of work and sometimes you forget to add it  etc.

    Or to make it short: To penalize the "black sheeps" out of there who abuse the "nofollow" attribute.
    Wednesday, February 18, 2009 2:28 AM
  • Interesting. That's too bad because if everyone did what you did, then pagerank would just fail to be of any use anymore, right? I understand the frustration with YouTube and Wowhead using nofollow, but surely they are doing that to prevent abuse from spammers--isn't that exactly what nofollow was designed for?

    I have to admit I'm not really familiar with a lot of the more advanced SEO best practices...

    Friday, February 20, 2009 12:42 AM