Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hyper link url does not open without opening referring or parent page

-I have a job link

https://sjobs.brassring.com/TGWebHost/jobdetails.aspx?SID=%5eNJ9jpo3wVSbfK0NxdHECJijC2rWHbZl4%2f7afCQpgRyliOu2Weq1%2few7zT1iEt2vW&jobId=804091&type=search&JobReqLang=1&recordstart=1&JobSiteId=5011&JobSiteInfo=804091_5011&GQId=1640

-When I paste it to a browser url and hit enter, it results in

ErrMsg=NoCookieGetSessionIdForXML (The page does not load)

-However on the same browser if I open its referring or parent page

https://sjobs.brassring.com/TGWebHost/searchopenings.aspx?partnerid=25222&siteid=5011

-Then open a new tab, again on the same browser i go to the same link above

https://sjobs.brassring.com/TGWebHost/jobdetails.aspx?SID=%5eNJ9jpo3wVSbfK0NxdHECJijC2rWHbZl4%2f7afCQpgRyliOu2Weq1%2few7zT1iEt2vW&jobId=804091&type=search&JobReqLang=1&recordstart=1&JobSiteId=5011&JobSiteInfo=804091_5011&GQId=1640

this time the page is loaded successfully. I scrape the jobdetails urls (not the searchopenings url) and present them users on my own page. So can you please point me to how to achieve this? I have tried to trouble shoot and I think it may have to do with establishing session/cookies but still cant figure it all out. Thanks in advance for any help.

like image 700
Dung Avatar asked Nov 09 '22 07:11

Dung


1 Answers

The problem is because the user is missing the appropriate cookie, as the comments and other answer says. However you don't have to go to such difficult lengths to pull in a cookie from a remote source, You can simply load a resource from that site in your html. Loading the resource will set the cookie in the users browser. This way when the user clicks on the link, they already have the cookie.

In the example below, I am loading the parent page in a hidden iframe, but if you find that an image also loads the cookie, you could just add that without bothering with an iframe.

<iframe src="https://sjobs.brassring.com/TGWebHost/searchopenings.aspx?partnerid=25222&siteid=5011"
        style="display:none"></iframe>

<a
        href="https://sjobs.brassring.com/TGWebHost/jobdetails.aspx?SID=%5eHN7W7Qzw%2fF7gatWoBM6cE0ccmSO%2fucQkl75UsUrOYMnVywG9mXDR2RR1QJ0dl_slp_rhc_16&jobId=790214&type=search&JobReqLang=1&recordstart=1&JobSiteId=5011&JobSiteInfo=790214_5011&GQId=1640">Because the hidden iframe adds the cookie, this link works now!!</a>
like image 182
Mobius Avatar answered Nov 15 '22 12:11

Mobius