PDA

View Full Version : Parsing HTML Page and Refresh


coder090
10-08-2002, 03:12 AM
Hi,

What I am trying to accomplish is to load a dynamically generated page (asp to be exact) and to have javascript evaluate the HTML that is output to the browser to determine if it contains a specific string I am looking for. If it doesn't, it will refresh it, wait to load, check to see if it contains the string, and if not repeat. It should do this infinately until the string is found and it will just stop and let the user take control and navigate as normal.

1) This page is an external site, so I will not be placing the JS within the actual page I am evaluting for the string.
2) Because of this, I think a frame set of 2 frames (one with my JS code and one for the external web site) would work. The JS would look at the other frame and control the refreshes based on the content it generates.

I am not a JS guru by any means, and I have looked all over for info on parsing html and controlling another frame and haven't found anything too valuable. Can I do it like I think I can?

Also, would it be easier to accomplish the same thing with VBscript (marcos)?

Please, if anyone can help me with some code, give me ideas, or just point me to some other reference, I would REALLY appreciate it.

Thank you for your time and insight!!!
J Berse

glenngv
10-08-2002, 03:22 AM
so, the site you are trying to control is not on the same domain as you? have you heard of cross-domain security (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp)?

coder090
10-08-2002, 04:39 AM
I see... makes sense. So basically, that is not possible. That leads me to another **possible** (?) solution, VBscript. I realize this is not a VBS forum, but while I'm touching on what I'm trying to accomplish, maybe you can tell me if this is possible using VBscript (marcos ? ) and hopefully point me to a resource that might examine such a technique.

Thanks for eliminating JS from the equation. AT least I'm not barking up the wrong tree now.


J Berse

glenngv
10-08-2002, 10:54 AM
you still can't do it using client-side vbscript.
maybe server-side vbscript (asp):

http://www.4guysfromrolla.com/webtech/040600-1.shtml

Alekz
10-08-2002, 04:08 PM
Hi,
It's possibe to do server side with XMLHTTP from ASP or using the CURL module for PHP (or just sockets)...
Client side, it can not be done through a script as glenngv said, but I think it should be possible using an Applet, ot Flash, or Macromedia Director movie, or even an ActiveX control - it depends on browsers...

Alex

coder090
10-08-2002, 06:46 PM
Ok...

I should clear this up. This is just something for me to use. I can use any browser, doesn't matter to me. But I can't imagine that VBscript cannot read the html source in my browser window. All I want to do is set my browser to a URL on ebay. I then want to run some sort of program/marco that looks at the html source, checks for a string and immediately refreshes the page if the string I am looking for does not exist and repeat until the browser is closed or the program is stopped. This can't be done server side because once the string is found, the page will no longer be auto refreshed and the user will navigate (bid in this case) as normal.

If you have no ideas with a little vbs, I suppose C++ would be my next step. Although I'm not great with it, I can get to the point of embedding explorer in an app and hopefully being able to research the rest.

Thanks

glenngv
10-09-2002, 02:04 AM
if you were able to do it by any other means, it would be a great hack! :eek:

cross-domain security (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp)
"While domain security can prevent certain types of content interaction, it is important to understand that this restriction is necessary to ensure security. For example, without domain security, a rogue page could "snoop" on another page or, using DHTML, manipulate its content. "

Alekz
10-09-2002, 07:29 AM
Hi,
It will be better to do this with an ordinary executable or service if You are on a NT box... The executable can download HTML for example once per minute, check for the string and if it's found launch the browser with a specific URL...
But if You have to be logged in in order to get this done, You'll have to emulate a browser - post data, send cookies, etc...

Alex