-3

This code appends iframe after set intervals:

    <script type="text/javascript">
    function random_no(){
    var ran=Math.random();
    jQuery('#random_no_container').html(ran);
    }

    window.setInterval(function(){
    $(document).ready(function () {
    var pagivews;
    pageviews = '<iframe src="#" width="100%" height="100%">'+'<'+'/iframe>' 
    $(document).ready(function () {
    $('#ifdiv').append(pageviews)
    });
    });      random_no();
    }, 10000);  // Change Interval here to test. For eg: 5000 for 5 sec
    </script>

    <div id="ifdiv"></div>

Is it possible to append a html page to get a pageviews within a page?

1 Answers1

0

What do you mean by 'Page View'? What you are doing is rendering iFrames to your page. If you want to get 'Page Views' for a page the best way to do it is generating requests to the page - that can be done in multiple ways (here is the php way):

PHP: use curl inside a loop to create requests to that page. (This can be achieved also without curl)

// Make a HTTP GET request and print it (requires allow_url_fopen to be enabled)
print file_get_contents('http://www.example.com/');
Niv Apo
  • 983
  • 1
  • 9
  • 18