Get content of the page given by an URL thru Javas

2019-08-25 14:45发布

问题:

Does anybody here solved a similar problem?

I have a link that contains nothing but another link.

For example, given a URL lets say it is www.abc123proxy.info. And then that URL contains another URL on its page (yeah, just text) lets say the URL for this one is www.masked-url.com?token=231940812093810. I need go to the second URL but I only have the first URL.

This is what I want to happen:

$(document).ready(function() {window.location = 'www.abc123proxy.info';});
// But I wanted to go to the link inside the page of that URL.

Is this problem can be solve using javascript? I'm open for other better solution if you have.

Thanks!

回答1:

$.ajax({
        url:'first_url',
        type:'get',
        success:function(data){
          var _newUrl=$(data).find('a:first');
        }
})