PDA

View Full Version : New Window Script


Dalziel
11-19-2002, 11:47 AM
I have a frameset with two frames, the top one is a search box, the bottom one is a results page, I want to put a button in the top frame with the value "New Window" that will open whatever page is loaded at the bottom in a seperate window, I don't know how to capture the URL of the page in the bottom frame though, any help appreciated :thumbsup:

glenngv
11-19-2002, 11:53 AM
as long as the page at the bottom frame is in the same domain as yours, you can do it.

window.open(top.frames["frameNameHere"].location.href)

Dalziel
11-19-2002, 01:16 PM
Why does the page need to be from the same domain? :mad:

Dalziel
11-19-2002, 03:05 PM
The form is used to search the web so the thing to open in a new window could be anyone's page (search engine results page could go anywhere) is there any way to do what I said? :( :rolleyes:

glenngv
11-20-2002, 12:55 AM
cross-domain security (http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp)

whammy
11-20-2002, 01:16 AM
Since it is important to be able to navigate windows or frames to any URL beyond the domain restriction, these types of accesses are always permitted. Only access that attempts to read out or modify content is restricted. For instance, the href property might be assigned to cause navigation to occur, but this property cannot be read if the URL is of a different domain. This would allow one page to learn where the user has been browsing, and to allow this is a breach of the user's privacy.


Not to mention, this kind of security helps to prevent "shifty" web developers from just including pages from someone elses' site and [insert your favorite deity here] forbid, claim it's their content. Although there's no way to "protect" your content at all, and I DON'T want to turn this thread into a "how do I protect source code" thread.

I'm not saying YOU do that, but it is a valid concern. :)

Dalziel
11-20-2002, 11:51 AM
I can't do it then, shame, I don't see the security issue though, if it's framable I don't see why I can't open it. btw: how do ask jeeves do the remove this frame thing then?