开发者

How to make this bookmarklet work on Safari?

I am trying to make a bookmarklet test. Below 开发者_运维问答code works on FireFox but couldn't on Safari 4.0.3. Does anybody know how to make it work on Safari?

javascript:var s = document.createElement("script");
s.text = "document.write('hello');";
s.type = "text/javascript";
document.body.appendChild(s);


Try with: s.innerHTML = "document.write('hello');";


You need to add document.close() after document.write(...);

javascript:(function(){
  s=document.createElement("script");
  s.type="text/javascript";s.text="document.write('Hello88');document.close();"
  document.body.appendChild(s);
 })();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜