Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Adding "target" Attribute To All Links

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Marsh - 11 Dec 2007 12:06 GMT
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!

Signature

Chris Marsh

Chris Marsh - 11 Dec 2007 12:37 GMT
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

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

[..]

Cheers!

Signature

Regards

Chris Marsh

Duy Lam - 11 Dec 2007 16:17 GMT
> All
>
[quoted text clipped - 9 lines]
>
> 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 :-)

Signature

Duy Lam Phuong


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.