Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Dec 2010
    Location
    Germany
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    URL for iframes not showing in address bar

    I apologise if this is in the wrong section. I have built a website using iframes at: http://www.krillmeed.com/ but when clicking through the menu, the address bar still stays at http://www.krillmeed.com/ no matter which page is loaded into the iframe. I have seen a number of javascripts around that can change this, but most do not seem to work anymore. Has anyone a sure way to correct this please

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    ?? The address bar always shows ONLY the URL of the main page. If it was showing the URL of one of your iframes, then the iframe would take over the entire page. That is, it would no longer *BE* an iframe.

    You will pardon me if I say I don't believe you have seen "javascripts around that can change this". If you have, where?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    you can use javascript to change the hash of the main page, the url after the "#".

    to convert a site you need to :
    1. alter the hash on every view change
    2. inspect the hash at start-up and dispatch the required view.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    Ahhh...or you *could* just ignore the hash...that is, not actually have any matching <a name="xxx"> even though the URL is "http://www.site.com#xxx".

    No?

    So you can put anything at all after the hash without having any real effect on the page. The user gets a visual indication without any changes to the rest of the code.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New Coder
    Join Date
    Dec 2010
    Location
    Germany
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rnd me View Post
    you can use javascript to change the hash of the main page, the url after the "#".

    to convert a site you need to :
    1. alter the hash on every view change
    2. inspect the hash at start-up and dispatch the required view.
    I think this is what i have seen with the # and then the page name. Could i have a bit of an idiots guide on how to accomplish this?

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    Okay...

    Code:
    <html>
    <head>
    <script>
    function doit()
    {
        var url = location.href;
        var psat = url.indexOf("#");
        if ( psat > 0 )
        {
            inner =  url.substring( psat + 1 ) + ".html";
            document.getElementById("INNER").src = inner;
        }
    }
    </script>
    </head>
    <body onload="doit()">
    This is the main body.
    <p>
    This is the main body.
    <p>
    This is the main body.
    <p>
    This is the main body.
    <p>
    <iframe id="INNER" style="width: 100%; height: 200px;"></iframe>
    </body>
    </html>
    So if you save that as, say, "demo.html" and then invoke the page via, say "demo.html#xyz" it will load "xyz.html" into the iframe.

    Is that what you are after?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New Coder
    Join Date
    Dec 2010
    Location
    Germany
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Tried that or at least i think i did, but i am sure that is due to my lack of understand rather than you explanation.
    Here is what i did to my index.html page:

    Code:
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
    <META HTTP-EQUIV="Content-Language" CONTENT="en-us">
    <meta http-equiv="Expires" content="Fri, 01 Jan 1999 00:00:01 GMT">
    <LINK rel="stylesheet" href="lcars.css">
    <script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    <script>
    function doit()
    {
        var url = location.href;
        var psat = url.indexOf("#");
        if ( psat > 0 )
        {
            inner =  url.substring( psat + 1 ) + ".html";
            document.getElementById("PageContent").src = main.html;
        }
    }
    </script>
    <TITLE>Krillmeeds Star Trek site</TITLE>
    </HEAD>
    <body onload="doit()">
    <BODY class=Template bgcolor=Black>
    <div class=TopPanel>
    <body onload="doit()">
      <script language="javascript">AC_FL_RunContent = 0;</script>
      <script src="AC_RunActiveContent.js" language="javascript"></script>
      <script language="javascript">
    	if (AC_FL_RunContent == 0) {
    		alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
    	} else {
    		AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','100%','height','100%','title','Top','src','pages/bars/top','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','scale','exactfit','movie','pages/bars/top' ); //end AC code
    	}
      </script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="100%" title="Top">
        <param name="movie" value="pages/bars/top.swf">
        <param name="quality" value="high">
        <param name="SCALE" value="exactfit">
        <embed src="pages/bars/top.swf" width="100%" height="100%" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"></embed>
      </object></noscript>
    </div>
    <DIV ID=Buttons Class=Buttons></DIV>
    <DIV Class=SidePanel>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    <script language="javascript">
    	if (AC_FL_RunContent == 0) {
    		alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
    	} else {
    		AC_FL_RunContent(
    			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',
    			'width', '46%',
    			'height', '90%',
    			'src', 'pages/bars/side',
    			'quality', 'high',
    			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
    			'align', 'middle',
    			'play', 'true',
    			'loop', 'true',
    			'scale', 'ExactFit',
    			'wmode', 'transparent',
    			'devicefont', 'false',
    			'id', 'pages/bars/side',
    			'bgcolor', '#000000',
    			'name', 'pages/bars/side',
    			'menu', 'true',
    			'allowScriptAccess','sameDomain',
    			'movie', 'pages/bars/side',
    			'vertical-align: top', ''
    			); //end AC code
    	}
    </script>
    </DIV>
    	<DIV Class=InternalPage>
    <IFRAME ID="PageContent" NAME="PageContent"
    src="http://www.krillmeed.com/main.html" ID="PageContent" height=87% width=100% SCROLLING=AUTO FRAMEBORDER=0></IFRAME>	</DIV>
    <DIV ID=Cursor></DIV>
    	<INPUT TYPE=HIDDEN ID=SoundFlag><INPUT TYPE=HIDDEN ID=MouseFlag>
    <SCRIPT Language=text/javascript>
    var position = document.URL.indexOf('=')+1;
    var length = document.URL.length;
    var url = document.URL.substring(position, length);
    
    isDOM=document.getElementById?true:false;
    if ( isDOM ) {
    	document.getElementById('PageContent').src = url;
    }
    else {
    	PageContent.src = url;
    }
    
    if ( isDOM ) {
    	if ( document.getElementById("MouseFlag").value == "" ) {
    		HTMLText = "<IMG BORDER=0 Name=MouseToggle ID=MouseToggle src=\"images/MouseOff.gif\" onClick=\"ToggleMouse();\">";
    		document.getElementById("Buttons").innerHTML = HTMLText;
    		document.getElementById("MouseFlag").value = "SHOW";
    	}
    	else {
    		if ( document.getElementById("MouseFlag").value == "HIDE" ) {
    			HTMLText = "<IMG BORDER=0 Name=MouseToggle ID=MouseToggle src=\"images/MouseOn.gif\" onClick=\"ToggleMouse();\">";
    			document.getElementById("Buttons").innerHTML = HTMLText;
    		}
    		if ( document.getElementById("MouseFlag").value == "SHOW" ) {
    			HTMLText = "<IMG BORDER=0 Name=MouseToggle ID=MouseToggle src=\"images/MouseOff.gif\" onClick=\"ToggleMouse();\">";
    			document.getElementById("Buttons").innerHTML = HTMLText;
    		}			
    	}
    }
    
    if ( isIE && isDOM ) {
    	if ( document.getElementById("SoundFlag").value == "" ) {
    		HTMLText = "<IMG BORDER=0 Name=MusicToggle ID=MusicToggle src=\"images/MusicOff.gif\" onClick=\"ToggleMusic();\">";
    		document.getElementById("Buttons").innerHTML = document.getElementById("Buttons").innerHTML + HTMLText;
    		document.getElementById("SoundFlag").value = "PLAY";
    	}
    	else {
    		if ( document.getElementById("SoundFlag").value == "STOP" ) {
    			HTMLText = "<IMG BORDER=0 Name=MusicToggle ID=MusicToggle src=\"images/MusicOn.gif\" onClick=\"ToggleMusic();\">";
    			document.getElementById("Buttons").innerHTML = document.getElementById("Buttons").innerHTML + HTMLText;
    		}
    		if ( document.getElementById("SoundFlag").value == "PLAY" ) {
    			HTMLText = "<IMG BORDER=0 Name=MusicToggle ID=MusicToggle src=\"images/MusicOff.gif\" onClick=\"ToggleMusic();\">";
    			document.getElementById("Buttons").innerHTML = document.getElementById("Buttons").innerHTML + HTMLText;
    		}
    	}
    }
    
    </SCRIPT>
    </BODY>
    </HTML>
    I do know someone who has the same kind of design, but the person who did it for him has since disappeared from public life so to speak, so he cannot help. http://www.lcars.org.uk/index.html
    Sorry for being such a pain, if its not possible i can live with it, but it would be nice all the same.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    That isDOM crap became unnecessary with MSIE 5. If you are really worried about people who are still using MSIE 4, maybe you need to worry more about people who disable javascript completely.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    New Coder
    Join Date
    Dec 2010
    Location
    Germany
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Sorry you feel so strongly about it. That was the script i was given with the style, that is also greek to me LOL


  •  

    Posting Permissions

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