0

Im trying to get my iframe to not break if its sent to websites with same orgin, I need it to recognize that nothing is going to load and automatically be redirected to another location.

But the javascript has to be able to determine any site, without having to make a list of 1000 sites or just that the browser itself isnt detecting content available so default to a new location.

Any help would be greatly appreciated.

var inputArea = new Ext.form.TriggerField({value: '', emptyText: 'Input Web Address', width:155, qtip:'Input web address and hit enter.', listeners: {  
specialkey: function(f,e){
if ( e.getKey() == e.RETURN || e.getKey() == e.ENTER ) {
 //document.getElementById("center-iframe").setAttribute('data', 'http://' +f.getValue());
 var element = document.getElementById("center-frame");
 var result = f.getValue().search(new RegExp(/^http:\/\//i)); 
 if( !result ) {
    element.setAttribute("data", " " +f.getValue()); 
    } else {
      element.setAttribute("data", "http://" +f.getValue()); 
    }
}

} }});

This is the code im currently using when it comes to a user inputing their own link to change the object, i need to know how i would go about makeing it looking for sameorgin sites or anything that wont or shouldnt load in a object/iframe/frame any of the above. Currently if you put google.com in this and hit enter it breaks the object. I need to find a way to make it so that doesnt happen and just defaults them to a specific page.

Thank You

Avalonhill
  • 41
  • 1
  • 5
  • Eeh what? How are you doing it with a list of 1000 sites? Why is your iframe breaking anyway? – putvande Jul 10 '14 at 16:26
  • Sameorgin seems to be breaking it, i need something that if the sameorgin IE if the iframe tries to load Google or Facebook or something like that have it redirect to a default page. – Avalonhill Jul 10 '14 at 16:41
  • Have you tried looking at [this question](http://stackoverflow.com/questions/4548984/detect-if-the-iframe-content-has-loaded-successfully)? – dwitvliet Jul 10 '14 at 17:49
  • yes but its still not a solution to what i need it to do. More or less if the object or frame breaks because of page that isnt meant to be loaded in a iframe i need it to redirect to a default source, without added 1000 sites that dont load in iframes there would be no way to keep up. It needs to be able to look and see that the specific page cant load in a iframe and then do it automatically – Avalonhill Jul 10 '14 at 18:11
  • Any help anyone can give me would be very helpful, ive looked all over the internet to try and find a solution and i cant seem to come up with anything even in the direction im going. – Avalonhill Jul 10 '14 at 19:02

0 Answers0