|
Haven't registered yet? Do it here now!
|
nicky
Joined: 07 Oct 2011 Posts: 26
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 5:24 am Post subject: Forcing links to open in a new window |
|
|
|
|
|
|
|
|
|
|
I want to use a sponsor's RSS feed in a sidebar and there is no way to add a target attribute to the link in the RSS widget.
The smartlink plugin does not seem to work for sidebar links.
I have a piece of java script but the upgraded wordpress forces changes to the script when you save in a text box and it does not work at all.
Has anybody any ideas?
I have just discovered that the script changes forced by wordpress also prevent statcounter from being installed on new blogs - this is actually a far more serious issue. |
|
|
|
|
|
|
|
kaktus Owner
Joined: 22 May 2004 Posts: 1576 Location: CheapestAdultScripts.com
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 7:29 am Post subject: |
|
|
|
|
|
|
|
|
|
|
Hi there,
i have just tested javascript code and statcounter code in a Text widget and all is normal, i don't see anything changed or something broken. Are you sure you are using a regular Text widget to put your javascript code?
As about the new window links, i don't see such an option to be available in WP.. _________________
|
|
|
|
|
|
|
|
|
|
|
nicky
Joined: 07 Oct 2011 Posts: 26
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 7:53 am Post subject: |
|
|
|
|
|
|
|
|
|
|
Yeah there is only one text box. I got stat counter to work by using the XHTML compliant code. There is a new window option at the bottom of the Smartlinks plugin settings but I seem to recall that Smartlinks don't work with later versions of WP. I also set it to noindex but that has no effect either.
I also tried enclosing the javascript with CDATA and comment tags but that didn't work.
This is the java I want in a text box (it should really go in the <head>)
<script>
function externalLinks()
{
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++)
{
var anchor = anchors[i];
if(anchor.getAttribute("href"))
anchor.target = "_blank";
}
}
window.onload = externalLinks;
</script>
When I click save it becomes this:
<script>
function externalLinks()
{
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++)
{
var anchor = anchors[i];
if(anchor.getAttribute("href"))
anchor.target = "_blank";
}
}
window.onload = externalLinks;
</script>
And doesn't work. I assume it's something to do with XHTML compliance but I don't know. |
|
|
|
|
|
|
|
kaktus Owner
Joined: 22 May 2004 Posts: 1576 Location: CheapestAdultScripts.com
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 8:22 am Post subject: |
|
|
|
|
|
|
|
|
|
|
It looks like the plugin allowing javascript,embeds and etc.. got broken. I have fixed it now, so try now to put the javascript code. For me it gets imported fine.. _________________
|
|
|
|
|
|
|
|
nicky
Joined: 07 Oct 2011 Posts: 26
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 8:44 am Post subject: |
|
|
|
|
|
|
|
|
|
|
Thank you. I'll give it a try now. |
|
|
|
|
|
|
|
nicky
Joined: 07 Oct 2011 Posts: 26
|
|
|
|
|
|
|
Posted: Tue Dec 04, 2012 9:01 am Post subject: |
|
|
|
|
|
|
|
|
|
|
Thanks kaktus, it's working great now! |
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|
|
phpBB Template designed by SkaidonDesigns |
|
| |