PDA

View Full Version : [HTML]Javascript][JQuiry?]Is it possible?



JPHamlett
01-18-2015, 04:51 AM
Is it possible to access information from site A from a script on site B on the same computer.

Example: I need to retrieve the name of someone in Site A,

It appears to be stored in this code



<span style="width: 1px"><input id="incident.caller_id" class="direction:ltr" type="hidden" onchange="onChange('incident.caller_id')" name="incident.caller_id" value="cac2822e4cc8a500fbf04c45b7ae6e38"><input id="sys_display.original.incident.caller_id" type="hidden" name="sys_display.original.incident.caller_id" value="THIS IS WHERE THE NAME IS">


Can I retrieve that info from site B somehow?

akarigar
01-18-2015, 12:01 PM
Since it sounds like you own both the sites, you can use CORS to make cross domain requests. Here (http://www.html5rocks.com/en/tutorials/cors/) is a pretty decent tutorial that will help you set it up. Feel free to send me a PM if you have any more questions.

J J
01-18-2015, 01:26 PM
Retrieve the page with jQuery and parse the HTML to get the value?
$.get
$.ajax

JPHamlett
01-19-2015, 12:08 AM
Retrieve the page with jQuery and parse the HTML to get the value?
$.get
$.ajax

The issue is that the URL does not change. The name seems to be stored in a javascript applet(not sure about the terminology). Can I grab the fields of javascript?

I can pull the code up when I right click and select inspect element on Chrome.

Fairly similar to old school reflection.

J J
01-27-2015, 05:41 AM
The issue is that the URL does not change. The name seems to be stored in a javascript applet(not sure about the terminology). Can I grab the fields of javascript?

I can pull the code up when I right click and select inspect element on Chrome.

Fairly similar to old school reflection.
If Chrome can show it then you can grab the value.
With the help of http://api.jquery.com/jquery.parsehtml/ or a different library it is certainly possible to grab the fields.

grats
01-30-2015, 02:06 AM
as said, CORS
assuming you own both sites. cross domain security complaints / issues have been around for a long time
other than that you'd need some naughty hacks to have the client get the page in the background & parse through it is probably the easiest part.. or use php/something else to


assuming it is your site access_control_allow_origin header should be '*' for all or 'whatever site name is' for CORS

parsing shouldn't be your biggest issue.. and you shouldn't be using all of jquery to do so


<span style="width: 1px">
<input id="incident.caller_id" class="direction:ltr" type="hidden" onchange="onChange('incident.caller_id')" name="incident.caller_id" value="cac2822e4cc8a500fbf04c45b7ae6e38">
<input id="sys_display.original.incident.caller_id" type="hidden" name="sys_display.original.incident.caller_id" value="THIS IS WHERE THE NAME IS">

<script>

var wut = document.getElementById('sys_display.original.inci dent.caller_id').value;
console.log(wut);
</script>

http://i.imgur.com/7qk8Jv6.jpg