Click to See Complete Forum and Search --> : looking for an exception
motuiti
05-05-2007, 10:44 AM
I use <BASE TARGET="_blank"> in the header for the usual reasons.
I would like to make an exceptions to that. IE; where one actually leaves the site to the intended link instead of opening the link on top of the active page.
Please any suggestions
Sandy
coothead
05-05-2007, 11:54 AM
Hi there motuiti,
try it like this...
<!--[if IE]>
<base target="_blank">
<![endif]-->
coothead
motuiti
05-05-2007, 01:13 PM
Actually no luck with that code. Where it it to be placed? I tried in place of the
<BASE TARGET="_blank">
And at the link for which I want the exception - no luck?
What does the IE stand for -- Not Interner Explorer?? I use a Mac
So what I am trying to do is; all click to enlarge picts open up on top of home page. All outside links go directly site without opening on top of home page
Sandy
Charles
05-05-2007, 02:40 PM
By "IE" Mr. Coothead understood "Internet Explorer" and not "id est". Give all of your external links a class of "external" and try something like:<script type="text/javascript">
onload = function () {
var e, i = 0
while (e = document.links[i++]) {
if (/\bexternal\b/i.test e.className) {
e.onclick = function () {
window.open (this.href, '')
return false
}
}
}
}
</script>
coothead
05-05-2007, 02:57 PM
By "IE" Mr. Coothead understood "Internet Explorer" and not "id est".
As one would. ;)
Thanks, Charles, for understanding my understanding. :)
coothead
motuiti
05-05-2007, 04:30 PM
Youe said
Give all of your external links a class of "external"
Not sure how you do that?
Sandy
coothead
05-05-2007, 04:50 PM
<a class="external" href="http://www.external.com/">external link</a>
coothead
Major Payne
05-06-2007, 02:11 AM
Or?
target _blank
_parent
_self
_top
Where to open the target URL.
* _blank - the target URL will open in a new window
* _self - the target URL will open in the same frame as it was clicked
* _parent - the target URL will open in the parent frameset
* _top - the target URL will open in the full body of the window
Curtsy of w3c.org (http://www.w3schools.com/tags/tag_a.asp).
Mostly used in frames, but seems to work on any page using a doc type of transitional.
Ron
motuiti
05-06-2007, 01:54 PM
A Apologise for my ineptitude in all this but I've tired the advice evey which way and no luck. I'll try one more time and say it again a different way.
I use the <BASE TARGET="_blank"> code to allow links to open up in front of the page I'm on. Now I dont want that feature to work on external webaddress sites.
1) the<BASE TARGET="_blank"> still remains
2) I pasted in the aforementioned JavaScript in the body (1st thing)
3) I added this suggestion
<a class="external" href="http://www.external.com/">external link</a>
And tried is every which way and keep gettint the words "External Link " printed out in front ot my link.
Thats where I am at present. I'm sure I over looking something so basic to all those that are trying to help me but I just cant figure it out
Charles
05-06-2007, 03:18 PM
One of the problems here has been that until this last post it hasn't been very clear just what you are trying to accomplish. No doubt you are not a native English speaker, but please forgive us.
The method that takes the least thought but the most effort would be to add a target="_blank" to each link that you want to open in a new window. Aside from the effort, the "target" attribute is just yucky.
Give this a try:<script type="text/javascript">
onload = function () {
var l, i = 0
var r = new RegExp ('^' + location.protocol + '//' + location.hostname)
while (l = document.links[i++]) {
if (!r.test (l.href)) l.onclick = function () {
window.open (this.href, '')
return false
}
}
}
</script>That should work, though there might be something wrong with it. I've blocked all pop ups and such and so cannot test it. Also, it will only work on line, not locally.
motuiti
05-06-2007, 05:49 PM
THIS is what I want to do. I want My click to enlarge pictures to open on top of my webpage. Any other outside http address links will go to that page closing my page. In other words <BASE TARGET="_blank"> only working for insite stuff)
The Script above didn't work (while still using <BASE TARGET="_blank">)
Charles
05-06-2007, 06:41 PM
Any other outside http address links will go to that page closing my page.I have no idea what that means.
Can you post a link to a page where my script doesn't work?