Click to See Complete Forum and Search --> : Retrieve url of current page
TenKracer
02-26-2004, 02:28 PM
I have a site made up of 2 frames... I want 1 frame to be able to retrieve the url of the 2nd frame. I have been using things like location and it works well as long as I am within my own pages but if the user say navigates him/herself to google on the second frame when I try to get the location it tells me access denied. Is there a different way to do this. All I want is a frame with a button and a textbox that when clicked will display the current url of the second frame.
Any help will be most appreciated
Thanks,
olerag
02-26-2004, 07:05 PM
Alter your "target" accordingly and put the text where you
want it. In an alert it can be...
<a href="http://www.google.com" target="_blank" onClick="alert(this);">Google</a>
Hey, since your a local, tell me the best trout holes "down
there"?
TenKracer
02-26-2004, 07:33 PM
Thanks for the reply...
What I really need is a little different than that.
Say I have 2 frames in 1 frame I have a text box and a button. The other frame is just chillin and I'm doing nothing to it. The user uses this second frame to actually navigate through the internet and can go to any site they want. At some point if the user clicks the button in the first frame I want to display the current location of the second frame. So if they had gone to google and searched for boots and then went to boots.com the textbox would display boots.com
I have kinda gotten it to work but it gives me an error (Access Denied) if it is a site that I am not hosting.
Any ideas?
Oh, and I am new to New Zealand. You're actually talking to a New Yorker. Not sure about any trout holes but I'll ask around for you... You thinking about coming down here?
Thanks
evnafets
02-27-2004, 03:49 AM
Nope can't be done, unless they allow you specifically.
Cross frame scripting only works within the same site. Its a security measure.
TenKracer
02-29-2004, 01:03 PM
That is what I thought it might be. Do you know of anyway to do this at all? Maybe using something else like asp? I have to believe there is a way to get this info... Like how do those google tool bars work?
chrismartz
02-29-2004, 01:52 PM
you can do this in asp...just look at the following link and I hope it helps you:
http://forums.webdeveloper.com/showthread.php?s=&threadid=29000
TenKracer
02-29-2004, 02:06 PM
thanks for that but it seems to be more for if i control the link action.
This is reading a variable passed in the url. I don't have that option as I want the user to be able to navigate on the second frame using other peoples sites and then when they want to click on that button on the first frame to display their current location in the second frame so I have no control over the variables in the url.
I am really suprised that this isn't allowed as it seems to me that the browser must have this information in order to display the page so why would it not be allowed to display it.
TenKracer
02-29-2004, 02:21 PM
Wow,
I think I have asked the wrong question. Let me try again.
I have a single web page served on my server.
It has 2 frames.
1 frame (Called Frame1) has a button and a textbox.
the second frame (Called Frame2) displays say... google.com
I want the user to be able to do whatever they want using Frame2 so they could search for cars in google and get some results back and then navigate to any of those sites using the links and what not.
At some point if the user wants they can click on the button in Frame1. If they do this I want to display the URL of the site that is being displayed in Frame2. I have been told that I cannot do this using JavaScript for security reasons which I believe because of the error message that I am getting when I try.
I do however think that there must be a way as the browser does display the page and would be unable to do this without knowing the url.
I see where you are going with the asp stuff but it seems like the wrong direction to me as it is very complicated and won't actually get me the information I need for a couple reasons that I can see.
The major one is that if they are navigating in Frame2 my asp will not be re-executed and will be unable to get the correct url to begin parsing.
Thanks for the tips though,
steelersfan88
02-29-2004, 02:45 PM
yea this is one security flaw actually taken care of on the Internet, sorry
I can see where everyone went wrong though, almost as if we put words in your, umm, post
TenKracer
02-29-2004, 02:47 PM
Ha, thanks.
Am I the only one that thinks this is a little strange? What kind of security threat could this pose?
steelersfan88
02-29-2004, 02:50 PM
well the fact that asp can do something of this sort and javascript can't really doesn't secure anything. If a programmer wanted like a hidden frame and to retrieve the URL of every page you visited and every key you typed, they could use othe rlanguages, so why can't javascript do it? I'd agree with you on that, doesn't seem like a huge threat if javascript could do it because there are ways around it!