Click to See Complete Forum and Search --> : Javascript and target window
I have a question regarding javascript and target windows.
I'm using an external linked javascript to put syndicated content onto my portal:
<script language="JavaScript" src="http://www.theirpage.com/applets/factoid.js">
</script>
Due to formatting issues with the portal software that I'm using, I want any hyperlinks that are produced in the resulting page to display in a new window. Is there anyway to accomplish this, since I do not have access to the source code?
Thanks,
Heather
Try adding this in your <head> tag. I've never tried it, but I'd think it would work...
<base target="_blank">
This works in about half the cases. I'm guessing that if the source code has a target coded for the link, it takes precedence. Is there anyway of overriding that?
Maybe they have that protected... something like..
<base href="_somereallylongnameorsomethingthatnoonewouldthinkoffiguringoutoranythinglikethatbelievemesometimesit sgoodtobeirrelevantinthiscaseanyways">
Originally posted by heha
This works in about half the cases. I'm guessing that if the source code has a target coded for the link, it takes precedence. Is there anyway of overriding that? No, I believe the inline targets will take precidence.
Originally posted by Jona
<base href=" _somereallylongnameorsomethingthatnoonewouldthinkoffiguringoutoranythinglikethatbelievemesometimesit sgoodtobeirrelevantinthiscaseanyways">What are you talking about? :confused:
Charles
02-11-2003, 01:22 PM
You can easily overwrite the value of the target attribute for every link on a page, the trick is to keep your links opening in the parent window. Give all of your links a class name of "local" and try:
<script type="text/javascript">
<!--
window.onload = function () {for (i=0; i<document.links.length, i++) {if (document.links[i].class != 'local') document.links[i].target = 'child'}
// -->
</script>