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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:43:53+00:00 2026-06-10T03:43:53+00:00

i wrote some code to get the html source code but it is working

  • 0

i wrote some code to get the html source code but it is working only IE8,but not working on mozila and chrome , what is the problem , please give me suggestion.
my code

<script>

        function processStateChange() {
            statusDiv = document.getElementById("stats");
            if (req.readyState == 0) { statusDiv.innerHTML = "UNINITIALIZED"; }
            if (req.readyState == 1) { statusDiv.innerHTML = "LOADING"; }
            if (req.readyState == 2) { statusDiv.innerHTML = "LOADED"; }
            if (req.readyState == 3) { statusDiv.innerHTML = "INTERACTIVE"; }
            if (req.readyState == 4) {
                statusDiv.innerHTML = "COMPLETE";
                statusDiv.innerHTML = req.responseText;
            }
        }
        function GetXmlHttpObject() {
            if (window.XMLHttpRequest) {  // code for IE7+, Firefox, Chrome, Opera, Safari
                return new XMLHttpRequest();
            } if (window.ActiveXObject) {  // code for IE6, IE5 
                return new ActiveXObject("Microsoft.XMLHTTP");
            } return null;
        }
        //req = new XMLHttpRequest("Msxml2.XMLHTTP");     
        req = GetXmlHttpObject();
        debugger;
        if (req) {
            req.onreadystatechange = processStateChange;
            req.open("GET", "http://whatismyipaddress.com/", true);            
            req.send();
        }

    </script>

i checked to debug the code IE was completely working the loop(req.readystate==4 to finally get the response text) but mozila or chromes are only working loop(req.readystate==2 after abort the loop), what is the problem, please give me some suggestion, using jquery or java script to solve the problem

Thank u
hemanth

  • 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-06-10T03:43:55+00:00Added an answer on June 10, 2026 at 3:43 am

    Due to the same origin policy restriction you cannot send cross domain AJAX calls. The reason this works in IE is probably that you are using some old dinosaurish version of IE that has some bugs and allows such an AJAX request. But no modern browser will ever allow you to do that.

    You can send AJAX requests only to the domain from which originated the page containing the javascript code sending the AJAX request.

    There are some workarounds depending on the level of control you have over the remote domain. In your case I guess that you have no control over http://whatismyipaddress.com/. So your only option is to write a server side script on your domain that will serve as a bridge between your domain and the remote domain and then send the AJAX request to your script:

    req.open("GET", "/myscript", true); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I mean that I use below code to get html source from url. But
I wrote some code that activity starts a service to get some text from
I've wrote some code in order to parse and display to my html some
i get some HTML returned from an external source and set to a simple
I'm working on a project that involves taking some source code and boiling it
I wrote some code in VHDL that is expected to look at a rotory
I wrote some code to read a file in my Java Servlet class. (I'm
I wrote some code which monitors the output of Stopwatch using a tight loop.
I wrote some code (Java and LDAP) to create a user in the Active
I wrote some code for the ising model in python (2d). Everything looks seems

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.