2

I searched in SO first, and found this question. How to click a link that has javascript:__doPostBack in href? but it gives the answer in python only.

What I need is, when go through a website, some pages (2,3,4, etc) with links like below:

javascript:__doPostBack('AspNetPager1','2')
javascript:__doPostBack('AspNetPager1','3')
javascript:__doPostBack('AspNetPager1','4')

If I click it, and it will display the next page, but the real url isn't displayed in browser.

So my questions is, how can I convert the javascript link into traceable real url and feed to wget/curl/lynx?

My purpose is to use the tools (wget/curl/lynx) to download these pages one by one by scripting. But because of these javascript:__doPostBack, I can't find a good way to do it.

Community
  • 1
  • 1
BMW
  • 42,880
  • 12
  • 99
  • 116

1 Answers1

2

You can't really do it analytically. __doPostBack could be arbitrarily complex.

What you should do instead is install Firebug (assuming you are using Firefox), activate the Network tab, press "Persist", and then click that button. The Network tab will show you the actual network traffic, and you can deduce the real URLs from that. In fact, you can just right-click on the particular network request that interests you and select "Copy as cURL" and it will put the curl instructions -- complete with things like cookies and headers -- in your paste buffer.

There is a similar function built-in to Chrome.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144
  • Thanks, I have firefox (of course), and have install two add-ons: `httpfox`, and `Live HTTP Headers`. Let me try `firebug`. – BMW Apr 22 '14 at 06:43
  • @Malvolio Can you help elaborate more? I'm having exactly the same problem, but I'm not sure how to deduce the real URL from the network traffic. – halo09876 Jun 17 '16 at 21:29
  • @song0089 -- are you looking at the Network _panel_ of the debugger? Both Chrome and Firebug have on option (by clicking on the request) of "copy as cURL". If you are looking at the network traffic directly (e.g. with Wireshark), look for a line reading "Host: xxxxx" and another with "GET yyyy" -- xxxx/yyyy is the URL. – Michael Lorton Jun 17 '16 at 23:11