21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2124 Views |
-
use onclick=window.open instead of _target blank

24 October 2010 at 5:26pm
I'm a newbee and just proved it by posting this first in the wrong forum;-) So much to learn!
I am very impressed with SilverStripe so far. One thing that really impresses me is the amount of valid code!
One place puts out invalid code and I think it would be a trivial fix if I knew where to change the code. Perhaps there is a good reason for using a target _blank but i was wondering if it could instead use "onclick=window.open(this.href); return false;" When I am editing a page, click to insert a link, and click the checkbox to open a new window it inserts the html code _target blank. The page is an xtml page and therefore it doesn't validate. If I click the html editor button and fix the html when I click insert the code gets stripped.
Is that a simple fix? Could someone tell me how to do it?
Thanks,
Wade -
Re: use onclick=window.open instead of _target blank

25 October 2010 at 12:40am
You can create a textparser to replace all target="_blank" in Content with a class="external" and use jQuery to open those links in a new window..
http://doc.silverstripe.org/recipes:syntax-highlighting#text-parser
http://www.sspaste.com/paste/show/4cac633e6fcd6
http://snipplr.com/view/4626/jquery-snip--open-link-in-new-window/ -
Re: use onclick=window.open instead of _target blank

25 October 2010 at 12:26pm
Thanks Martijn
That looks like the info I was looking for. Will take a while till I'm up to speed enough to attempt it though;-) For now I will just add a note to right click to open links in a new window.
Wade
| 2124 Views | ||
|
Page:
1
|
Go to Top |


