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 119267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:37:34+00:00 2026-05-11T03:37:34+00:00

I want to write some javascript and have it call into the DOM for

  • 0

I want to write some javascript and have it call into the DOM for a page I am loading from a 3rd party domain. Can this be done? This looks like what I’ve already tried using IFRAME but it would seem that doesn’t work. Is these some other way like having FF run some javascript directly rather than as part of a page?

I know this has all kinds of security problems but I’m the guy writing the code and the only guy who will run it.


The backstory: I’m trying to automate some web site iterations.

My fist IFRAME pass didn’t work because a web page from file:////.... is not in the same domain as a page in http://whatever.com. Surprise, surprise.

  • 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. 2026-05-11T03:37:34+00:00Added an answer on May 11, 2026 at 3:37 am

    If I understand the question correctly, you probably won’t be able to do it using Javascript alone, because of the domain restriction that you experienced. However, if you have some knowlege on using shell scripts, or any scripting language, it should be no problem, all you need to do is invoke the good old curl.

    Example in PHP:

    <?php $url = 'http://www.example.com/index.html'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); $fp = curl_exec($ch); curl_close($ch); ?> 

    And that’s pretty much it. You have the actual HTML code in the $fp variable. So, all in all, what I would do is write a little Javascript Ajax function to PHP which does the curl and then returns the $fp variable via echo to the Javascript callback, and then maybe insert it on the document (using innerHTML or the DOM), and bam, you have access to all the stuff. Or you could just parse it in PHP. Either way, should work fine if you do it through curl. Hope that helps.

    Edit: After some thought I seem to remember that Safari removes the cross domain restriction for localhost. After researching some more, I’m unable to find any documentation that supports this theory of mine, so I dug a little deeper and found a better (although hackier) way to accomplish this whole mess via Apache if you’re using it (which you probably are).

    Apache’s mod_proxy will take a request for something like “/foo” and actually tunnel the request to some remote destination like “http://dev.domain.com/bar”. The end result is that your web browser thinks you’ve made a call to http://localhost/foo but in reality you’re sending and retrieving data from a remote server. Security implications solved!

    Example:

    LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule rewrite_module modules/mod_rewrite.so 

    Let’s assume that I want to access a file at http://dev.domain.com/remote/api.php. You would put all of the following into a :

    # start mod_rewrite RewriteEngine On ProxyRequests Off <Proxy>    Order deny,allow    Allow from all </Proxy>  ProxyPass /apitest/ http://dev.domain.com/remote/api/ ProxyPassReverse /apitest/ http://dev.domain.com/remote/api/ RewriteRule ^/apitest/(.*)$ /remote/api/$1 [R] 

    Source

    More edit:

    Seeing as how you want to avoid the whole server setup thing, I gave it a shot using an IFRAME on Safari (Mac), and it worked, at least for the domains I tried:

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'> <html> <head> </head>     <body>         <iframe src='http://www.stackoverflow.com/'></iframe>     </body> </html> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 115k
  • Answers 115k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Did you checkout ExNewT ? btw, it is not that… May 11, 2026 at 10:21 pm
  • Editorial Team
    Editorial Team added an answer As much as the OS wants to give you. By… May 11, 2026 at 10:21 pm
  • Editorial Team
    Editorial Team added an answer If you try to evaluate .Value (etc) - then yes,… May 11, 2026 at 10:21 pm

Related Questions

I'm sure I'm going to have to write supporting javascript code to do this.
I'm working on a JavaScript application that has to perform two separate checks via
I have a couple of solutions, but none of them work perfectly. Platform ASP.NET
I run a website (sorta like a social network) that I wrote myself. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.