Everyone knows yahoo mail. When you just logged on to your account you see on the page "You have 0 unread messages". I just womdered is there any way how can i find something on the page using javascript and return as variable. So what i've done is:

1. I have a frame with src="http://mail.yahoo.com"
2. every 10 seconds it refreshes iframe

Now i need to find in the content of iframe that "simple number" and display it on the title.
Example @ http://www.geocities.com/cppforlife/projects/html/yahoo.html

thanks everyone...

Recommended Answers

All 3 Replies

You cannot do this client-side, because that would mean a script from your domain would need access to the contents of a page from another domain, and browsers don't allow that. You'll need to use a server-side language to perform what's called "screen scraping". I found this discussion on client-side scraping: http://ask.metafilter.com/mefi/23180

Thank you for answer but i am not sure because i saw somewhere it.
you can call predefined function find like (ctrl+f) and it will return result.
then you look at the result and take it. sounds easy but how to do that. i am sure i saw that method somewhere ...

Thanks

-------------------------
Also i dont know what's it . Is it bug in IE. Sometimes(if i ususally open page it works but when i refresh it it gives me error) when set interval to 1 milisecond (setInterval("func()", 1)) browser gives me error 'getElementById is null or not an object'.

|
\/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
  <title>Progress Bars</title>

<script>
var curr=0;
var curr1=1;
var max=8;
var str="";
function add(){
     curr++;
     str=str.concat("&#127;");
     document.getElementById('pb').innerHTML="<b>"+str+"</b>    "+curr;
}

var count=setInterval("add()", 3000);

function add1(){
     curr1++;
     document.getElementById('pb1').style.width=curr1;
}

function clearAll(){
   clearInterval(count);
   clearInterval(count1);
}

var count1=setInterval("add1()", 100);
setTimeout("clearAll()", 200000);
</script>
</head>

<body>

<div name=pb id=pb style="border: 1px solid blue; height: 20px" valign=center></div>

<div style="position: absolute; left: 120px; top: 90px; background-color: red; width: 1px; height: 20px" name=pb1 id=pb1></div>

</body>
</html>

very useful thing that progress bars...

Thanks again

A 1ms interval? Yes, I'd imagine that would cause problems. Either it isn't enough time for your function to run, or the element hasn't been rendered yet.

Sorry, you can't run cross-domain scripts. You're welcome to keep searching and correct me if I'm wrong (it won't be the first time!), but your best bet really is to do server-side screen scraping.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.