Results 1 to 3 of 3

Thread: New Window + Top Frame with Offsite Links

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default New Window + Top Frame with Offsite Links

    Hi all,

    I was wondering if anyone could point me in the right direction to search for the script that will perform the following:

    Basically when someone clicks a link on my site to an external site a new window pops up with the external site but at the top of the external site I would like a section to allow me to include my site logo on the external site at the top of the page. This is similar to UserCash script for those that are familiar with UserCash.

    I have searched google and found a script on dynamic drive which allows external links to appear in a new window but I am not sure what to search for to help with the top section on the external site.

    Any help or guidance would be very very much appreciated.

    Thanks in advance

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You don't need a script.

    Just link to "http://mypage.com/showgoogle.htm" with target="_blank".
    Then, on that page, just use frames to show the outside page below your logo or whatever is at the top.

    you could also use php (maybe javascript) to do this dynamically... like show.php?site=http://thispage.com, and that will use the added part of the url what is displayed.


    Also, with php, there is a frameless version... like this:

    YOUR LINK:
    <a href="showpage.php?site=http://google.com/" target="_blank">

    showpage.php code:
    PHP Code:
    <html><body><img src="image.jpg"><hr></body></html>
    <?php include $_GET['site']; ?>
    And you're done. The include command grabs the page and puts it on your page.

    Actually, though, it will have some issues with local links/files and might do some weird stuff to the formatting of your image. The double body tag and html tag (above and from the real page) should be ok, but aren't standard, certainly.


    The best way is with frames. You could use php like above, but set a frame's src with the $_GET variable instead of setting/using an include command.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks for the very prompt reply djr33

    The problem, I believe, with using the method provided is distinguishing between links to external sites and pages within my own site and I would like every link on my forum that links to Imagevenue, Imageshack and other image hosting sites to load the page with a frame at the top containing logo and html content.

    With usercash.com the following needs to be inputted into the <head> or <body> of the site

    Code:
    <script>
    var domain='mysite.com';
    var uid='1259';
    var what='1';
    </script>
    <script src="http://www.usercash.com/uc.js"></script>
    I understand that var domain shall be mysite.com so links on my site do not load in a new page with frame at top.

    var uid and var what are not required so they may be removed to give the following

    Code:
    <script>
    var domain='mysite.com';
    </script>
    <script src="http://www.mysite.com/script.js"></script>
    UC.js includes the following:

    Code:
    var url='http://usercash.com/go/'+what+'/'+uid+'/'+"";
    var domains='skins.be,usercash,adultfriendfinder,imagecash,twistedblogs,****ster.blogspot.com,postyouramateur.com,noref.net,mediabux.com,crazywog.com,****enmeer.nl,pronny-king.be,uniquepeek.com,ebonyword.blogspot.com,top-blogs.com,rapidshare,pointzero.juicy****host.com,linkbux,imagegravy,adbrite,clicksor,'+domain+''+"";
    function c(){var link=document.getElementsByTagName("A");try{var loc=(""+top.location.href).replace("http://","").replace("https://","").replace("www.","");}catch(e){var loc=(""+document.location.href).replace("http://","").replace("https://","").replace("www.","");}for(i=0;i<link.length;i++){domain_url=(""+link[i].href).replace(/^\s+/g,"").replace(/\s+$/g,"").replace("http://","").replace("https://","");if(d(link[i].href)&&(((" "+link[i].href).indexOf(loc)<=0||(" "+link[i].href).indexOf("http")<=0)||(" "+link[i].href).lastIndexOf("http:")>3)&&(" "+link[i].href).indexOf("script:")<=0&&(" "+link[i].href).indexOf("#")!=1&&(" "+link[i].href).indexOf("mailto:")<=0&&(" "+link[i].href).indexOf("file:")<=0&&(" "+link[i].href).indexOf("#exit")<=0&&!(!isNaN(parseInt(domain_url.substr(0,1)))&&(!isNaN(parseInt(domain_url.substr(0,2)))||domain_url.substr(0,2)=="."))){link[i].target="_blank";link[i].href=url+link[i]+"";}}}function d(url){if(""+domains!="undefined"&&domains!=""&&domains.replace(/\s/g,"")!=""&&url!=""){if((" "+domains).indexOf(",")>0){params_to_skip=domains.split(",");}else{params_to_skip=new Array(domains);}for(s=0;s<params_to_skip.length;s++){if((" "+url.toLowerCase()).indexOf(params_to_skip[s].toLowerCase())>0){return false;break;};}return true;}else{return true;}}if(""+window.onload==""||""+window.onload=="null"){window.onload=c;}else{var tout=window.setTimeout("c(); clearTimeout(tout)",4000);};
    I have spent hours trying to modify the above code to no avail.

    I changed

    Code:
    var url='http://usercash.com/go/'+what+'/'+uid+'/'+"";
    to

    Code:
    var url='http://mysite.com/go/index.php'+'/'+"";
    and uploaded the index.php to the go directory

    Once I insert click a link on my site a new window loads with my php file loaded but the external site does not load beneath it.

    I apologise if I am making basic errors as I am very new to javascript and have tried modifying the code for ages to no avail.

    Many thanks in advance

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
  •