Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Search page output with JavaScript or VBScript?

Posted on 2003-10-30
5
Medium Priority
?
239 Views
Last Modified: 2011-09-20
I have created a form which passess the necessary values to an already existing page which resides on another server in our company which I do not have access to modify.  The page is hidden in an invisible iframe so the users do not know that the process is running.

I am able to pass it the required information for it to run its processess to completion, however I don't know if they were successful.  I am looking for a way to search the result page for the words "success" or "failed" which appear in the body of the output when the processes are complete.

I have tried the following script, but it does not work for outside pages (ex: try setting an iframe called 'inside' to this page and run it). It gives the "Access denied" error.

function verifySuccess(str)
{
      var txt, found;
      txt = this.top.test.document.body.createTextRange();
      found = txt.findText(str);

      if (found)
      //when verified, continue with program
      {      processSucceeded();      }
      return false;
}

function checkIt()
{
      var result = verifySuccess('Did it work');
      //if unsuccessful after 90 seconds, consider it failed
      setTimeout("resetFailed()",90000);
      if (result == false)
      {      setTimeout("checkIt()",5000);      }
}


When viewing the results page in IE, if you press ctrl+F or go to Edit...Find (on this page), it finds the "success" or "failed" message.  Is there a way to use JavaScript, VBScript, or anything else to run IE's find program?
0
Comment
Question by:NorvilleR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9653893
Hi,

  'access denied' means just that

  instead of writing out success/failure, try setting a variable true/false  and then testing the variable's state/existence/value.  I suspect that also may fail, and that you will either have to get 'signed permissions' or do this server-side

Vinny
0
 

Author Comment

by:NorvilleR
ID: 9664442
I completely understand the 'access denied' part.  That is not my question.  As the question states, I currently have no way of accessing the variables from the existing program.  My scripts simply automate the process of filling in the necessary fields to perform the process.

What I am looking for is a way to search the text that is displayed on the response page.  This page says whether or not the process completed successfully.  All I want to do is use some type of search, like the one built into IE (edit, find), to search the page for that word.
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 1000 total points
ID: 9664794
Hi,

  The reason your code fails (as well as the suggestion I made regarding a var) is that you cannot access any part of the DOM  -- alert(frameName.document) gives the error.  There is no way to do it in javascript.  Any 'find in page' script requires having access to the DOM.

Sorry, but you will have to do this server-side, with permissions

Vinny
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question