Results 1 to 3 of 3

Thread: Is it possible to modify iframe to detect url?

  1. #1
    Join Date
    Dec 2007
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Is it possible to modify iframe to detect url?

    1) Script Title: Iframe SSI script II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...iframessi2.htm

    3) Describe problem:

    I am planning on using this script on my page and wanted to know if this is possible:

    If the iframe is navigated to a certain url by the user clicking on the link (in this example google.com) then the script would detect that the iframe is now on google.com and would simply do a redirect of the entire page to google.com (or whatever url i decide on) so that the entire page now would display google.com instead of it being inside the iframe only.

    Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Add highlighted:
    Code:
    function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if(document.getElementById(iframeids[i]).src.indexOf('google.com')>1)
    	location.href='http://www.google.com';
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    If the iframe's URL contains "google.com", it will redirect the page to google.com

    Hope that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Dec 2007
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by rangana View Post
    Add highlighted:
    Code:
    function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if(document.getElementById(iframeids[i]).src.indexOf('google.com')>1)
    	location.href='http://www.google.com';
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    If the iframe's URL contains "google.com", it will redirect the page to google.com

    Hope that helps.
    Thanks so much for the help!!

    But for some reason this isn't working.. it worked if I had the original ifram call ask for google.com, but if it starts on another page and a user clicks a link to google it doesnt work for some reason. ?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •