Avoiding urls with sameorigin when using iframes
<p>I got this script that loads uls from a txt file, then puts them into a single frame one after another, and calculates how much time it took for that url to load. It works all fine untill i have some url with 'sameorigin' protection (google.com for example). If i have google in my list, it wont load any other urls after it starts loading google (it gets stuck). </p>

<p>I want to catch any urls that would give me 'sameorigin' error, and skip them, loading the next url instead. </p>

<p>I asked this on SO and was told to use a try catch block, heres my current script:</p>

<pre><code>&lt;script type="text/javascript"&gt;
           $.get("imones.txt", function (data) {
                var array = data.split(/\r\n|\r|\n/);
                var beforeLoad = (new Date()).getTime();
                var loadTimes = []; 
                    var beforeTimes = [];   
                $('#frame_id').on('load', function () {                                 
                    beforeTimes.push(beforeLoad);
                    loadTimes.push((new Date()).getTime()); 
                    try {
                        $('#frame_id').attr('src', array.pop()); 
                        $.each(loadTimes, function (index, value) {
                            var result = (value - beforeTimes[index]) / 1000; 
                                if (result &lt; 0) { 
                                    result = result * (-1);
                                }   
                            $("#loadingtime" + index).html(result);
                            beforeLoad = value;
                        });
                    } catch(ex) {}
                }).attr('src', array.pop());
            });
        &lt;/script&gt;
</code></pre>

<p>This current try catch doesnt do anything (i tried writing something with console in catch section but doesnt work). </p>

<p>How do i avoid thes 'sameorigin' urls?</p>
