severndigital Posted February 21, 2010 Share Posted February 21, 2010 i need to get the char count of the result of a url in php i would do this. $link = 'www.google.com'; $length = strlen(file_get_contents($link)); any help on doing this in javascript would be great. I need to resize some divs and iframes based off of the char count. Thanks, C Quote Link to comment Share on other sites More sharing options...
yozyk Posted February 21, 2010 Share Posted February 21, 2010 var length = document.getElementById('divId').innerHTML.length Quote Link to comment Share on other sites More sharing options...
severndigital Posted February 21, 2010 Author Share Posted February 21, 2010 the content i am trying to examine is being loaded into an iframe using the src attribute. so if i count the innterHTML all i get is 0. that is why i need to return the content of the page that is trying load into the iframe before it gets loaded. Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 21, 2010 Share Posted February 21, 2010 For security reasons JavaScript cannot access any files from domains different than the the script is coming from. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted February 22, 2010 Share Posted February 22, 2010 you'll need to use AJAX to contact a php file on your server that will contact the other domain. and then return the results to the javascript function Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.