• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent!! Opener is empty in javascript

 
yian
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I meet one serious problem in my project.
the opener is null if I open webpage from server A and use javascript 'window.open' to open a new window for displaying a page in server B.
But it works if I put these two html pages in one server
The sample codes are as following,
The alert window is shown if I put test1.html and test.html in serverA.
But the alert window is not shown if I put test.html in serverB but I put test1.html in serverA.
Does anybody can help me?
-----test.html----------
<html>
<head>
</head>
<body>
<script>
window.name = "testWinow"
window.open("http://serverA/test1.html")
</script>
</body>
</html>
----end of test.html--------
-------test1.html--------
<html>
<head>
</head>
<body>
<script>
alert(opener.name)
</script>
</body>
</html>
-------end of test1.html---------
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, you found out the wonderful security restrictios with javascript. The files have to be on the same server I am afraid. This is to keep people from using other peoples information. Stinks...doesn't it...
 
Randall Twede
Ranch Hand
Posts: 4371
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yian,
I hate to say this but, your name does not comply with the Javaranch naming guidelines which can be found at http://www.javaranch.com/name.jsp
please register again with a valid name.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you open a new window that contains a page on your site then use that page to automatically redirect to a page on another domain?
eg http://one.com/one.html

Then send them somewhere else

or similar...
Just a thought. Even if you got it to work, its a bit of a hack so I wouldn't trust it to continue working...
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic