Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7094137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:31:34+00:00 2026-05-28T08:31:34+00:00

Is it possible to retrieve all href elements on a page that is an

  • 0

Is it possible to retrieve all href elements on a page that is an iframe?

Meaning, I have a page that is iframing a page from different site. What I am showing in the iframe contains a number of links (href tags).

Is it possible to add a TARGET attribute of BLANK to all links inside the iframe? The links are buried inside a number of divs and tables, so I need to be able to recursively add the attribute inside many nested tables/divs.

EDIT:
Added screenshot to show extra characters needed to be removed:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:31:35+00:00Added an answer on May 28, 2026 at 8:31 am

    If the iframe src it’s on the same domain you can easily access it by using document.getElementById(“frameID”).document and manipulate that.

    If it’s a different domain you may consider link the iframe to a script in your own domain, and make that script download the data from the remote domain and print out:)

    myHTMLpage.html

    <html>
        <head>
        <title></title>
            <script src="jquery-1.7.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#ifr").load(function () {
                    var ifr = document.getElementById("ifr")
                    var anchors = ifr.contentDocument.getElementsByTagName("a");
                    for (var i in anchors) {
                        anchors[i].setAttribute("target", "_blank");
                    }
                });
            });
        </script>
        </head>
        <body>
            <iframe src="myOwnSite.aspx" width="900px" height="600px" id="ifr" ></iframe>
        </body>
    </html>
    

    myOwnSite.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyOwnSite.aspx.cs" Inherits="MyOwnSite" %>
    

    myOwnSite.aspx.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Net;
    
    
    public partial class MyOwnSite : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Response.Write(new WebClient().DownloadString("http://theExternalSiteHere.com"));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to retrieve items from a Python dictionary in the order that
I'd like to retrieve all table names from a database schema, and, if possible,
Basically I want to retrieve all possible substring matches with n characters from a
is it possible to retrieve all children of a certain type from a parent
Is it possible to retrieve all the static objects which have been created in
I want to retrieve all case-insensitive duplicate entries from an array. Is this possible
Is it possible to retrieve everything (all names) from javax.naming.InitialContext ? I didn't find
Is it possible to retrieve programmatically all the case of a switch ? I
Is it possible to retrieve variable set in onreadystatechange function from outside the function?
Is it possible to retrieve the underlying hostname/port from a new TcpClient? TcpListener listener

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.