...

View Full Version : URL for iframes not showing in address bar



krillmeed
12-30-2010, 12:59 PM
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 :)

Old Pedant
12-30-2010, 06:29 PM
?? 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?

rnd me
12-30-2010, 08:22 PM
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.

Old Pedant
12-30-2010, 09:30 PM
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.

krillmeed
12-31-2010, 09:30 AM
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?

Old Pedant
12-31-2010, 10:29 PM
Okay...



<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?

krillmeed
01-04-2011, 10:50 AM
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:


<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. :D

Old Pedant
01-04-2011, 10:23 PM
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.

krillmeed
01-05-2011, 08:02 AM
Sorry you feel so strongly about it. That was the script i was given with the style, that is also greek to me LOL



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum