Miki Cloud
Miki Cloud

Reputation: 53

Extract element from html source code with xpath scripting

Here I have a some HTML code and I need to 1st. load url source code then type xpath and as a result get a some text from that URL based on xPath... How to do that... with jquery, ajax ... ???

http://jsfiddle.net/cHtWq/

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<label>Enter URL address here: 
<input name="textfield" type="text" value="http://www." />
</label>
<label>
<input type="submit" name="Submit" value="Submit" />
<br />
<br />
Enter xpath location of element:
<input type="text" name="textfield2" />
<input type="submit" name="Submit2" value="Submit" />
<br />
<br />
Selected element is: </label>
<p>&nbsp;</p>
</body>
</html>

Upvotes: 0

Views: 869

Answers (1)

Manse
Manse

Reputation: 38147

You cannot do this in JavaScript because of the Same Origin Policy you will need some back end scripting to do this.

Upvotes: 1

Related Questions