"Open in Google Docs" code being automatically added to html – why?

  • Author
  • #939351


    This drives me nuts! Every now and again this code will automatically add it self to the links to download files in the html of a page or post during editing:

    onclick="if(!confirm('Open this file with Google Docs?'))return true;window.location='http://docs.google.com/gview?url='+this.href;return false;"

    I think it is this that then leads to a spawn of “pdf icons” next to the link.

    Why does happen and how do I stop it?

    I have to apologise that I did not spot the reply to my related question about the proliferating pdf icons that I asked in Sept 2010:


    In that case the code being automatically added was:

    <img src="http://docs.google.com/favicon.ico" alt="" /><img src="http://docs.google.com/favicon.ico" alt="" /><img src="http://docs.google.com/favicon.ico" alt="" />

    The reply then (apologies again for not spotting it until now) was:

    If it keeps happening, could you describe the exact steps you used to enter this image into your post, and how they are duplicated?

    – How did you insert the image? From the media uploader Image URL?
    – Did you reload the edit post page after you save it? Or did you reload the published page?

    The answer, as with this “open in Google docs” code is that I did not add anything myself: the codes for the icons and the code for opening in Google Docs added themselves.

    In reply to my question about the nuisance icons, naokomc asked whether the icons cloned themselves when I reloaded the published page or when I reloaded a page during editing. It was when I reloaded an already-published page. Very bizarre!

    I am assuming that my current question and my previous question are related as they are both about code to do with Google Docs stuff inserting itself automatically into published posts or pages.

    I have just cleared out all the code that automatically appeared as part of every pdf download link on this page, which is the same page that I gave as an example of the “automatic icons” problem in Sept 2010:


    That it is the same page is probably just a coincidence as the icon problem occurred elsewhere on my site – and I have seen it on other sites that I have visited.

    Best wishes,

    The blog I need help with is ukes4fun.org.uk.


    You are using some code that is not allowed here. See the top of this support page for the allowed HTML here.



    Wait, never mind my answer above.



    Thanks @thesacredpath – I was just wondering how I could explain the problem if I was not allowed to show the code :-)

    I have taken screen-shots of the codes cited in my first post in case they do get stripped-out.

    Best wishes,


    In general if you use the backtick, or the code tags here in the forums nothing should get stripped out.

    Screenshots are good too though. You can upload them to your media library and then post the URLs for them here for us to look at.



    I’m thinking maybe you have a browser add-on that is doing this. Test it by disabling ALL your browser add-ons for a test post, create the post, publish (make it a static Page, sub-page of an existing page, to reduce the public exposure) and see what happens. Then if no junk code is added, enable your add-ons one by one, updating the post each time. Once you see the error pop up, you know what add-on is doing it.



    Apologies if this is a really stupid question . . . but is there any chance that this Google Docs viewer code thing might be related to my having the Firefox “Google Viewer” addon enabled?




    Yes, there’s a strong chance. Disable it, do a complete restart of your computer, confirm it’s still disabled, and test it with a test page.



    Ooops! Thanks @raincoaster – I should have reloaded this page to check for new answers before posting the above! (So, not such a daft question, after all).

    The odd thing is that I have not seen this problem for months and then it has suddenly popped up again.

    After I had removed the problem code for the page I was editing today I did a few more edits and previews and it didn’t insert itself again.

    That was different from the previous problem with the icons – that code kept inserting itself over and over again after I had removed it.

    I have disabled “Google Viewer” and will watch out for any recurrences.

    I don’t know if this a related issue (I will do a search of these forums) but this is the first time for months that I have been able to see anything at all in the Visual Editor – usually I just see a white box with a few red dotted lines here and there.

    It started off the same way yesterday but I noticed that, after I had added an image using the “add media” icon while in html view, the Visual editor was working when I switched to Visual Editor. This was just on the off chance that I could use it to alter some image attributes.

    It might be just a coincidence that Visual editor has started working at the same time that the Google Viewer code problem has appeared.

    @raincoaster – do you think that the insertion of the icons that I asked about in 2010 might also be due to a browser addon? But how on earth could something like a browser addon insert code to an already-published page or post??




    Another post crossed in the ether :-)

    Thanks for the advice @raincoaster – will do!

The topic ‘"Open in Google Docs" code being automatically added to html – why?’ is closed to new replies.