简体   繁体   中英

Retrieve text from external HTML/asp page with JavaScript

I am using an external asp page (On the company's server - not related to me beside the fact that I'm using it for my job).

The asp page has one query in it, I'm writing something in it and it gives me some information.

In the information there is a certain line with constant header (let's assume 'HEADER'), I want to build an HTA that pulls the line that contains 'HEADER' to my HTA and display only this line.

I think that this isn't possible without any server interaction, but I'm asking anyway. Can someone think of a way doing it?

Thanks, Rotem

You can use an Ajax request to pull data from that page. The javascript page needs to be on the same server as the page you want to pull data from because of cross site scripting prevention in most browsers. Here is a good place to start: http://www.w3schools.com/ajax/ajax_intro.asp

Ok, I made something with JavaScript, using Telnet.

It isn't working for all sites, when I'll be at work I'll check it, but I think this will do the job.

The code:

<script type="text/javascript">
   var WshShell = new ActiveXObject("WScript.Shell");
   WshShell.Run("telnet -fc:/telnetlog.txt www.google.com 80"); // This will save me the source file + minor junk!
   setTimeout("WshShell.SendKeys('GET / HTTP/1.0~~')",1000); // Enter the command it telnet </script>

Thanks for the brainstorming, Rotem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM