473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How do I Get The HTML Source of Any Web Page

How can I get the HTML source of any web page.
Jul 1 '10 #1
8 2745
Dormilich
8,658 Expert Mod 8TB
Firefox: Ctrl + u
Safari + Chrome: Crtl + Alt + u
Jul 1 '10 #2
Sorry, I didn't explain it well.
I want to get the source code of page dynamically/problematically/through javascript etc.

below is code I tried to achieve the task but it does not and giving me error "ACCESS DENIED"
Expand|Select|Wrap|Line Numbers
  1.       <script language=javascript>
  2. var xmlHttp
  3.  
  4.  function DecodeThisVIN()
  5.  {
  6.  
  7.    url = "www.XYZ.COM"
  8.  
  9.  
  10.  xmlHttp=GetXmlHttpObject();
  11.  
  12.    xmlHttp.open("GET",url,false); //This is the line where I'm getting error
  13.  
  14.  
  15.    var getstatus = xml.status;
  16.  
  17.  
  18.    alert(getstatus);
  19.  
  20.  }
  21.  
  22.  
  23.  function GetXmlHttpObject()
  24.   {
  25.   var xmlHttp=null;
  26.   try
  27.   {
  28.   // Firefox, Opera 8.0+, Safari
  29.   xmlHttp=new XMLHttpRequest();
  30.   }
  31.   catch (e)
  32.   {
  33.   // Internet Explorer
  34.   try
  35.    {
  36.    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  37.    }
  38.   catch (e)
  39.    {
  40.    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  41.    }
  42.   }
  43.   return xmlHttp;
  44.   }
  45. </script> 
  46.  
Jul 2 '10 #3
Dormilich
8,658 Expert Mod 8TB
AJAX adheres to the "Same Origin Policy" (SOP), that means, it only fetches data from the same domain (for security reasons).
Jul 2 '10 #4
Okay, do you know another way do the above mentioned task?
Jul 2 '10 #5
Dormilich
8,658 Expert Mod 8TB
by a server side language.
Jul 2 '10 #6
@Dormilich
I tried it with asp but still getting error.
Expand|Select|Wrap|Line Numbers
  1.  Dim xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
  2.     xmlhttp.open ("GET", url, true)
  3.    xmlhttp.send ("")
  4.     Response.write (xmlhttp.responseText)
  5.     xmlhttp = nothing 
  6.  
Please note for above code xmlHTTP has third parameter as TRUE. In this case I get error "The data necessary to complete this operation is not yet available."

If I make it "FALSE" then get error "A connection with the server could not be established "
Jul 2 '10 #7
Dormilich
8,658 Expert Mod 8TB
this seems to be C# or something similar, where I can’t tell anything about it.
Jul 4 '10 #8
jkmyoung
2,057 Expert 2GB
Is there a specific reason you're using ASP? There are any number of simpler alternatives. What languages are you restricted to?
Jul 9 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Ludwig77 | last post by:
I read that there are some tags that can be entered in a web page's meta tags in order to prevent web bot searching and indexing of the web page for search engines. What is the tagging that I...
2
by: Simon | last post by:
Hello, A frameset contains 3 html pages: page A, page B and page C. I need to get the HTML source of page B. I tried to use AxWebBrowser to do that, but failed. Do you have any idea? Thanks,...
2
by: Kathy Burke | last post by:
Hi, I'm doing a fairly simple datagrid (copied it from one that works). When I run the page, it gets and binds the datasource ok, but then I get an unhandled app error at End Sub. I've found this...
3
by: news | last post by:
I am trying to get at the source of a web page. Looking at the innerHTML element is only part of the story. In IE, right-clicking on various different parts of the page gives me different results...
4
by: John Dalberg | last post by:
I have a weird problem. I have a webpage that displays a datagrid with data but when I use IE to view the html representation, the source has no table source for the datagrid. I used Opera, Mozilla...
6
by: John Dalberg | last post by:
Why does IE not show the full html source when I try to view the source?? I mean why does it hide a few features. Previously I had an issue where the data grid html representation was hidden in...
5
by: LP | last post by:
Hi, After html of .aspx page has been generated, but before it has been sent to a client, I want to interecept it, and slightly modify it. I can't find anyway to get html of a page. How can I do...
4
by: 28tommy | last post by:
Hi, I'm trying to find scripts in html source of a page retrieved from the web. I'm trying to use the following rule: match = re.compile('<script + src=+>') I'm testing it on a page that...
2
by: ste-m | last post by:
Hi there, I was wanting to calculate how long my web pages take to load, and to insert this time into my HTML source code (not visible from the browser, but only in source view) as a HTML...
23
by: andrew | last post by:
Hi, I have been taken to task about the length of lines in the source html of: http://www.slrn.sourceforge.org which, as I commonly do, has no line breaks at all in the source html. My...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.