Jump to content

Recommended Posts

what do you mean? Are you saying you want all "/xyz/somePage.html" links to have target="_top" attribute?  Sure, you can do this with javascript.  Easiest way is with a library like jQuery:

 

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
  // change /xyz/ to your directory
  $("a[href*='/xyz/']").attr('target','_top');
});
</script>

 

You can do something similar in Prototype or some other js library if you are already using one on your site (syntax will be slightly different). Or if you don't want to use a framework, you can do it with pure js with getElementsByTagName(), a for loop, getAttribute(), an if condition, and setAttribute().

 

Or you could of course just hardcode target="_top" in all your relative link tags...

 

Can you or someone please amend Crayon Violent's code to apply this condition?

I will learn this way, thank you!  :D

 

No you won't.  The only thing you will learn by having people just hand stuff to you is laziness.  Use your brain.  I provided you with code that will look for /xyz/ in the url.  How hard do you think it really is to replace "/xyz/" with "?site=" ? I assure you, it is not hard at all, and if you weren't so busy trying to freeload, you would see it easy enough. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.