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