Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2009, 09:27 PM
Registered User
 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to open and extract a HTML file content

Does anyone know how to open, read and extract a HTML file content (that stored in my local C driver) using JavaScript and C# from another web application?

I don't want to use window.open(), but I tried xmlhttp.open ('GET', 'my.html') or document.open() and used getElementsTagName or getElementsByID and I could not extract the html content at all. It's very frustrated.

I understand that you can use document.open and getElementsByID if the JavaScript functions are within the HTML file itself. But how about calling from another web application (that written in C# and JavaScript) then?

Any help would be appreciated it. Thanks.

Dhussan
 
Old July 20th, 2009, 03:02 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

When I needed to do this in COM, or JavaScript, I used to use a combination of FileSystemObject and the HtmlFile class. From C# you can use a StreamReader to open the file as normal, I'm not sure that the HtmlFile class can be used from .NET or if there's a similar class in the standard library. It seems likely that you could use it from .NET by using tlbimp.exe
__________________
Joe
http://joe.fawcett.name/





Similar Threads
Thread Thread Starter Forum Replies Last Post
extract content from file darkhalf Javascript 4 September 19th, 2006 12:29 PM
extract text and image content from .ppt file pratik28 C# 0 May 11th, 2006 06:20 AM
Executing asp Include file withing HTML content itHighway HTML Code Clinic 4 August 7th, 2005 01:03 PM
Include file in HTML content itHighway Classic ASP Basics 1 July 25th, 2005 05:44 PM
how flash button open html file mateenmohd Flash (all versions) 1 August 7th, 2003 06:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.