Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Adding "target" Attribute To All Links

Reply
Thread Tools

Adding "target" Attribute To All Links

 
 
Chris Marsh
Guest
Posts: n/a
 
      12-11-2007
All

We have a requirement to add a "target" attribute with a value of "_parent"
to any links in a given .aspx page, UNLESS a target has already been
specified for that link. We are not in control of content, the page in
question is referenced from an iframe, and we need any links from this page
to open in the browser window rather than the iframe. We already have a
Response filter in operation which replaces a token with a specified URL (a
logically separate task to this new task) - would it be a good idea to put
this additional functionality in the same Response filter class?

Would a regular expressiojn replace operation be a good idea, and if so
could anyone point me in the right direction of how to do this? I have
created the regexp for an anchor tag with no trouble, but I'm not sure how
to *not* match any anchor tags that already have a target attribute. I'm
also a bit shady on how to replace a string with a mutated version of that
string.

Anyway, in the meanwhile I'll RTM, but if anyone has any information or
advice I would very much appreciate it.

Cheers!

--
Chris Marsh


 
Reply With Quote
 
 
 
 
Chris Marsh
Guest
Posts: n/a
 
      12-11-2007
All

"Chris Marsh" <(E-Mail Removed)> wrote in message
news:%23q$mW5%(E-Mail Removed)...
> We have a requirement to add a "target" attribute with a value of
> "_parent" to any links in a given .aspx page, UNLESS a target has already
> been specified for that link. We are not in control of content, the page
> in


The following tag in the <head> section of the page does just what I need
<base target="_parent"> .

[..]

Cheers!

--
Regards

Chris Marsh


 
Reply With Quote
 
 
 
 
Duy Lam
Guest
Posts: n/a
 
      12-11-2007
Chris Marsh wrote:
> All
>
> "Chris Marsh" <(E-Mail Removed)> wrote in message
> news:%23q$mW5%(E-Mail Removed)...
>> We have a requirement to add a "target" attribute with a value of
>> "_parent" to any links in a given .aspx page, UNLESS a target has already
>> been specified for that link. We are not in control of content, the page
>> in

>
> The following tag in the <head> section of the page does just what I need
> <base target="_parent"> .
>
> [..]
>
> Cheers!
>


If you have used Theme, just insert HyperLink control to it
<asp:HyperLink runat="server" target=_parent">

Anyway, it's alternative option for you

--
Duy Lam Phuong
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a javascript attribute to all text form elements on an asp.net page Ken Fine ASP .Net 2 09-25-2006 07:39 PM
picking value of one attribute based on a child elements attribute? XPath? vjethava@gmail.com XML 2 03-06-2006 05:19 AM
Implied instance attribute creation when referencing a class attribute Russell Warren Python 5 01-17-2006 05:07 AM
XSLT: Making attribute to parent attribute Bostonasian XML 1 09-18-2005 07:30 AM
class attribute to instance attribute Donnal Walter Python 4 07-06-2005 04:35 AM



Advertisments