PDA

View Full Version : Accessing the source returned by a call to another page


cfdoubt
06-21-2003, 03:04 PM
Hi,
I have an URL ,say www.abc.d/e.asp?param1=val1 which will return me the following ( i mean to say that when i give this URL in the browser ,it asks me if i want to save a .js file which will have this content below)

document.write('<a href="http://www.xyz.a/index.cgi?param2=val2" target="_new"><img src="http://www.xyz.a/images/img.gif" alt="image"></A>');



I need to get hold of this returned code before it goes to the browser; so that i can extract the value of href,src etc. in my program.
The call is made as :

<script language="javascript"
src="www.abc.d/e.asp?param1=val1">
</script>
This will give the output to the browser and all i can see is the image and the link;over which i have no control

Please advise if there is a better way to call the page and get the data returned into a variable.All this should be in the background ( i mean no windows should pop up and current content should not be affected in any way)

The basic idea is that based on the values of param1, the abc.d site will return me a href and a link to an image which i need to use elsewhere on my site.

Hope i am clear.
Thanks,
<cfdoubt>

PS : this can be easily done using CFHTTP tag in ColdFusion, but it has got some threading issues ; so we are looking for alternate solutions (say javascript).

joh6nn
06-22-2003, 04:28 PM
not sure if i'm understanding what's going on.

it looks like your .js file is being dynamically generated by asp on the server side. do you have control over the .js file, or no? if you don't, then i'm not sure we can help you

cfdoubt
06-22-2003, 10:56 PM
Yeah,this .js is dynamically generated. If you give the URL www.abc.d/e.asp?param1=val1 in the browser, it opens a window prompting if we want to open the .js file or save it.

My status as far...

I used the view-source code ( which i copy-pasted from Net)

window.location.href = "view-source:" + document.getSource.url.value;

where document.getSource.url.value will have the value www.abc.d/e.asp?param1=val1 and was able to see the source of the returned js file in a separate window .Is there any way we can re-direct that "view-source" window contents to some variable..

Thanks,
<cfdoubt>

joh6nn
06-22-2003, 11:11 PM
there's no way to do that, that doesn't require an iframe or popup window or something. i'm assuming that you don't simply have access to the asp that's creating the .js file; if you do, you should just throw the the appropriate values into variables there. otherwise, you're SOoL

sorry

cfdoubt
06-23-2003, 05:32 PM
We dont have any control over the asp creating the .js ....Now, all i can try is to plug the js output directly into the place where it's required, instead of parsing its output. For me, this involves a change in the current layout..but if there's no other way...:((
thanks for ur informative help..
<cfdoubt>