473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Trouble retrieving window location from a previously opened window ?

Hi,

I am trying to open up a new window and then get the current url/location
back from the (win_1) window and display the url in an alert box.
Here is the code I am using :-

<script type="text/javascript">
var mywin_1 = open ("http://www.anysite.com/index.htm", "win_1",
"height=640, width=820, left=200, top=0, scrollbars, status, location");
var temp = mywin_1.location;
alert (temp);
</script>
Where am I going wrong?
Thanks in advance, Mark
Dec 24 '05 #1
2 1387
"Lee" <RE**************@cox.net> wrote in message
news:do*********@drn.newsguy.com...
Mark said:

Hi,

I am trying to open up a new window and then get the current url/location
back from the (win_1) window and display the url in an alert box.
Here is the code I am using :-

<script type="text/javascript">
var mywin_1 = open ("http://www.anysite.com/index.htm", "win_1",
"height=640, width=820, left=200, top=0, scrollbars, status, location");
var temp = mywin_1.location;
alert (temp);
</script>
Where am I going wrong?

4. If you do add a delay, and you do alert the value of location.href, you
will see an error message telling you that you don't have permission
to read the location of a window open on a site that differs from the
site that served the current page. It's a security feature to prevent
people from popping up new windows and then keeping track of where the
user navigates in that window.


Hi,

Thanks for your help on items 1 - 3.

The problem I was having (using Internet Explorer) was that it didnt
acutally display any alert at all (though did say access denied if I
double-click on the '!' on the status bar) obviously I now understand why.
Item #4 - I can understand about the security prevention, but I thought I
would be able to get around this with myself opening the window originally.
There must be some way to get the URL of an open window which the code is
not running in ? Any advice?

The web page in question is for use internally on a standalone machine so I
can lower any 'restrictions' in the actual browser if this needs to be ?

Thanks, Mark
Dec 24 '05 #2
On 2005-12-24, Mark <ma*******@horsemad.co.uk> wrote:
Hi,

I am trying to open up a new window and then get the current url/location
back from the (win_1) window and display the url in an alert box.
Here is the code I am using :-

<script type="text/javascript">
var mywin_1 = open ("http://www.anysite.com/index.htm", "win_1",
"height=640, width=820, left=200, top=0, scrollbars, status, location");
var temp = mywin_1.location;
alert (temp);
</script>
Where am I going wrong?


possibly

not serving your main page from http://www.anysite.com
--

Bye.
Jasen
Dec 25 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: N/A | last post by:
Hey all, If I open a popup like this window.open('http://www.google.com', 'popup', 'width = 618, height = 425, directories = no, location = no, menubar = no, resizable = no, scrollbars = yes,...
2
by: find clausen | last post by:
I have opened this fullscreen (framed) window from a "top-page-setup-box" if (window.opener.top.location ....... How can I close it again from the same page, like: ...
3
by: Farooq Karim | last post by:
Greetings; I am unable to solve this problem; I hope someone will come up to show his brilliance. From my web page I open another link in another browser window. That new window is composed...
14
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a...
0
by: Kenneth Myhra | last post by:
I am having some trouble debugging a project that is set up to be Registered as COM Interop. I will try to explain the problem here: If I add some code to the project, to for example the xxx.cs...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
6
by: Luke Matuszewski | last post by:
As in topic... has anyone used it ? I tried to use it but i guess i failed... here is a code: <html> <head> <title></title> <script type="text/javascript"> function closedWin() {...
7
by: Jaggu | last post by:
Hi , I need to close main window, once the child window succesfully opens else main window to remain. In my case when I close the main window immediately after the "window.open()" as mentioned...
6
by: mistral | last post by:
what is correct way open a PDF document in new window use hyperlink? I want show images thumbnails linked with PDF files, when click on thumbnail, PDF will be opened in new window. Some of PDF...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.