admin管理员组

文章数量:1399737

So I've got a bookmarklet which should open up a page in a new window.

javascript:window.open('.html','TimeTable%20Timer','status=no,directories=no,location=no,resizable=no,menubar=no,width=400,height=210,toolbar=no');

The code works perfectly in Safari, Firefox, and Chrome; but as expected IE (7 and 8) is causing problems. IE gives me a useless error when I open the bookmarklet, and no window opens.

I've tried to editing the bookmarklet so that it appends the page with a script tag. Then inside the script tag the window.open() code is added, or it accesses the script (which contains the window.open() ) [I've tried it both ways]

I'm at a loss now.

Anyone have any idea how to get the page to popup in IE (preferably with code that works in Safari, FF, and Chrome too)?

Thanks,

EDIT: The final code I ended up with:

javascript:(function(){ window.open('.html','TimeTableTimer','status=no,directories=no,location=no,resizable=no,menubar=no,width=400,height=210,toolbar=no'); })();

So I've got a bookmarklet which should open up a page in a new window.

javascript:window.open('http://timetableapp./TimeTable/bookmarklet/index.html','TimeTable%20Timer','status=no,directories=no,location=no,resizable=no,menubar=no,width=400,height=210,toolbar=no');

The code works perfectly in Safari, Firefox, and Chrome; but as expected IE (7 and 8) is causing problems. IE gives me a useless error when I open the bookmarklet, and no window opens.

I've tried to editing the bookmarklet so that it appends the page with a script tag. Then inside the script tag the window.open() code is added, or it accesses the script (which contains the window.open() ) [I've tried it both ways]

I'm at a loss now.

Anyone have any idea how to get the page to popup in IE (preferably with code that works in Safari, FF, and Chrome too)?

Thanks,

EDIT: The final code I ended up with:

javascript:(function(){ window.open('http://timetableapp./TimeTable/bookmarklet/index.html','TimeTableTimer','status=no,directories=no,location=no,resizable=no,menubar=no,width=400,height=210,toolbar=no'); })();
Share Improve this question edited Apr 5, 2009 at 22:34 Me1000 asked Apr 5, 2009 at 22:14 Me1000Me1000 1,7581 gold badge12 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

You can't have %20 or spaces in your window name. The name is for referring to the window again later in code.

Try:

javascript:window.open('http://timetableapp./TimeTable/bookmarklet/index.html','TimeTableTimer','status=no,directories=no,location=no,resizable=no,menubar=no,width=400,height=210,toolbar=no');

本文标签: javascriptBookmarklet In New WindowStack Overflow