3

Kind of awkward. I have tried a simple script in Google Chrome, Moz FF, Opera, and it works like a charm there, and normally should as well in IE, but somehow IE tells me

Object doesn't support property or method 'appendChild'

Strangely, my code is only this:

var close = document.createElement('button'); 
close.type = 'button';      
close.appendChild(document.createTextNode('CLOSE'));

I did have to turn off security settings in IE to enable the script to run because it is inside a bookmarklet (so dragged on the page). I found this post: appendChild not working with window.open in IE, and it says IE blocks appension in different window contexts. But in my case, how should I then append it 'in' the window?

Community
  • 1
  • 1
webketje
  • 10,376
  • 3
  • 25
  • 54

1 Answers1

0

I've created a bookmarklet using almost the same code and it worked for me using IE11

javascript:(function(){ 
    var close = document.createElement('button');
    close.type = 'button'; 
    close.appendChild(document.createTextNode('CLOSE'));
    document.getElementsByTagName('body')[0].appendChild(close);
  })();
securecodeninja
  • 2,497
  • 3
  • 16
  • 22