Forum Moderators: open

Message Too Old, No Replies

Masked URL's

Break out of Masked URL

         

Paul_2000

7:53 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Hi,

Please can someone tell me how when using the html 'refresh' command, break out of a masked url and show the url that is destination.

thanks Paul
P.s I have tried target "_top"

tedster

10:05 pm on Jun 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are speaking about using the meta refresh to breakout of frames, that tag does not accept a target attribute, at least not directly. You can refresh to a javascript url, like this:

<meta http-equiv="refresh" content="10; URL=javascript:window.open('page.html','_top');">

However, that will open an entirely new window as well. I think there should be a pure javascript approach, outside the meta refresh tag -- but I'm drawing a "_blank" ;) on it right now.

Paul_2000

5:28 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Thanks for that, I ran it on my desk top and the refresh functioned (could not tell if it broke out of masked url or opened new browser page), but when I uploaded to site it did not seem to do anything. What am I doing wrong please?

I also found this code that seems to break out of a masked url in the same window but I do not know how to customize / setup for my needs.

// Create the image url and write it into the page.
document.write("<a href=\"http://" + g_server + "/");
document.write(""+site+"\" target=_top>");
document.write("<img src=\"http://"");
document.write(""+site);
document.write(""+escape(g_r));
if (g_ip!= "")
document.write("&ip="+g_ip);
document.write("&hours="+g_hours);
document.write("&minutes="+g_minutes);
document.write("&rtype="+g_rtype);
document.write("\" border=0 title=\"Site Meter\"></a>");

tedster

6:28 am on Jun 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you simply need to have one link load a page that breaks out of frames, whether it's done through a meta refresh or not? If so, you could install ANY of the standard "frame busting" scripts in the head section of the document. The one that I use is this:

<script type="text/javascript">
if (top!=self.parent)
top.location=self.parent.location;
</script>

Paul_2000

10:33 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Yes, I think that is what i need.

if I want to re-direct to www.test.com how would the code you have given be written please.

Thanks

Paul

Paul_2000

10:35 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Oh,

I think I get you now, I just use a refresh html tag with the javascipt pasted into the doc as well.

Please correct me if I am wrong.

Thanks

Paul

Paul_2000

10:41 am on Jun 30, 2006 (gmt 0)

10+ Year Member



I have just tried by pasting

<script type="text/javascript">
if (top!=self.parent)
top.location=self.parent.location;
</script>

into the page but the masked url remains the same and browser does not show the refreshed url.

Please can you tell me what I need to do.

Thanks

Paul

tedster

5:56 pm on Jun 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Things to check:

Is this masking being enforced by your web host or some third party?

Maybe the problem is what you are calling "masked". I was assuming frames, but is this a frameset? If so, did you put the javascript in the head section of the framed document that the link is targeting (NOT the frameset document, for example?)

When an approach doesn't work, does View Source show your newly added code?

Paul_2000

6:40 pm on Jun 30, 2006 (gmt 0)

10+ Year Member



Hi tedster,

I got there in the end.

I pasted:

<script>

// (C) 2000 www.example.com
// http://www.example.com
// Free for all users, but leave in this header

if (parent.frames.length > 0) {
parent.location.href = self.document.location
}

</script>

into my html page and found that it made the url in the browser show the true url.

You see I needed a landing page so the site meter showed the masked url then I needed to refer the user to another page where I wanted the true url to be seen.

Thanks

Paul

[edited by: tedster at 7:01 pm (utc) on June 30, 2006]
[edit reason] use example.com [/edit]