For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > October 2005 > How Do You Get LWP To Deal With Javascript "Pop-Ups"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How Do You Get LWP To Deal With Javascript "Pop-Ups"
mark1.thompson45@btinternet.com

2005-10-20, 6:56 pm

Hi,
I am using LWP to navigate my way through the links on a webpage in
order to get to the data I need. I have got to the final page and it
seems that the data I need is in a "Javascript Popup". The page has the
following:-

<a href="javascript:popUp('PlayerList?gameid=184&catidx=1')"
class="nav">

It is the data in this pop-up that I need to get, forgive my lack of
knowledge here but LWP is new, whilst I have got this far I am now
completely stuck. If anyone can help it would be appreciated, a bit of
code would be even better - here's hoping.

cheers, Mark.

John Bokma

2005-10-20, 6:56 pm

mark1.thompson45@btinternet.com wrote:

> Hi,
> I am using LWP to navigate my way through the links on a webpage in
> order to get to the data I need. I have got to the final page and it
> seems that the data I need is in a "Javascript Popup". The page has the
> following:-
>
> <a href="java script:popUp('PlayerList?gameid=184&catidx=1')"
> class="nav">


The argument for popUp looks like a relative URL to me, so extract it, use
URI to create an absolute URL, and fetch it.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)

mark1.thompson45@btinternet.com

2005-10-21, 6:56 pm

OK, so I need to create the URL from the javascript (I think ?) anyway,
this is the part of the code where I am trying to link to:-

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<script
type="text/javascript">document.write(imgmapHtml);document.close()</script><img
src="/new/ytm2006/html/images/MAIN_BANNER_2005_6.jpg" width="770"
height="72" border="0" ISMAP USEMAP="#imgareas"><table width="770"
border="0" cellspacing="0" cellpadding="0"><tr valign="top"><td
height="44" colspan="4" class="navbar"><table width="770" height="34"
border="0" cellpadding="0" cellspacing="0"><tr>
<td width="540" valign="top" class="nav"><img
src="/new/ytm2006/html/images/game.gif" width="69" height="33"
hspace="5" align="absmiddle"><a
href="java script:popUp('/new/ytm2006/html/howtoplay.html')"
class="nav">How to play</a> | <a
href="java script:popUp('/new/ytm2006/html/scoring.html')"
class="nav">Scoring points</a> | <a
href="java script:popUp('/new/ytm2006/html/transfers.html')"
class="nav">Transfers</a> | <a
href="java script:popUp('/new/ytm2006/html/leagues.html')"
class="nav">Mini leagues</a> | <a
href="java script:popUp('/new/ytm2006/html/halloffame.html')"
class="nav">Hall of Fame</a> | <a
href="java script:popUp('/new/ytm2006/html/prizes.html')"
class="nav">Prizes</a> | <a
href="java script:popUp('/new/ytm2006/html/motm.html')"
class="nav">Monthly Game</a></td>
<td width="230" class="nav"><div align="left"><img
src="/new/ytm2006/html/images/stats.gif" width="90" height="33"
hspace="5" align="absmiddle"><a
href="java script:popUp('PlayerList?gameid=184&catidx=1')"
class="nav">GK</a> | <a
href="java script:popUp('PlayerList?gameid=184&catidx=2')"
class="nav">DEF</a> | <a
href="java script:popUp('PlayerList?gameid=184&catidx=3')"
class="nav">MID</a> | <a
href="java script:popUp('PlayerList?gameid=184&catidx=4')"
class="nav">STR</a> </div></td>
</tr>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am after the Player Lists for GK, DEF, MID or STR from this
javascript. If I click on any of these links (GK, DEF, MID, STR) in an
IE browser I get the following pages:-

http://www.youthemanager.co.uk/Clev...id=184&catidx=1
(or catidx=2, catidx=3 etc)

I cannot workout what URL to call in my LWP::UserAgent or URI::URL call
(not sure whic to use), what ever I call the only text I get back from
the page is:-

<HTML><HEAD><SCRIPT
LANGUAGE="JAVASCRIPT">location.replace("/");</SCRIPT></HEAD></HTML>

help appreciated, thanks.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com