0

I have written a bookmarklet that functions just fine in Chrome and Firefox but it IE 10 it fails to append to the document. I believe it has something to do with it being listed as "unrated" in the IE favorites bar, but I am not sure what part of the code is triggering that:

<a href="javascript:(function() {
    var elem=document.createElement('script');
    elem.setAttribute('type','text/javascript');
    elem.setAttribute('src', 'http://www.joshdforbes.com/web2mobile/
      web2mobile.js?t='+(new Date().getTime()));
    document.body.appendChild(elem); 
})()">Web2Mobile</a>

Having a hard time finding any information on the internet about what the differences are in IE10 that would be causing this. Any help would be appreciated.

Thanks!

Josh Forbes
  • 328
  • 3
  • 6

1 Answers1

1

It worked for me but I'm on IE8. Did you compress it first?

javascript:(function(){var elem=document.createElement('script');elem.setAttribute('type','text/javascript');elem.setAttribute('src','http://www.joshdforbes.com/web2mobile/web2mobile.js?t='+(new Date().getTime()));document.body.appendChild(elem);})()

I did get the warning message initially, but I ignored it and it worked.

Andy G
  • 19,232
  • 5
  • 47
  • 69
  • yeah, sorry I just spaced it out for some readability on here. It works for me in IE8 and IE9, but for some reason not in IE10. – Josh Forbes Jun 12 '13 at 01:19
  • nope I was wrong: I guess I didn't have it compressed. The code you pasted worked. Many Thanks – Josh Forbes Jun 12 '13 at 01:53
  • I use this page http://subsimple.com/bookmarklets/jsbuilder.htm to test and compress bookmarklets, but there are others around. Andy. – Andy G Jun 12 '13 at 10:55