Problem in opening new window.

B

boss

Hi ,
I am trying to open the same session in new window by closing
the parent window.
For that I am using the following javascript code:
var newWin = window.open("URL");
newWin.focus();
window.opener='x';window.close();

which is invoking the pop-up blocker blocker. After temporarily
allowing the pop-up and clicking OK in the information alert box, I am
getting an javascript runtime error.
The error reports newWin is null or not an object.
if I remove the newWin.focus() the newWindow also getting closed.

Please suggest me a solution
 
B

boss

Actaully I want to disable the back and forward buttons.
I tried many method like
1. history.forward(1);
2. var Backlen=history.length;history.go(-
Backlen);window.location='newPage.html';
3. Opening a new window.

But the first 2 methods are not fitting for me. So i have chosen the
3rd option.
if you know any other better option, that will also work for me.

Thanks
 
R

rf

Would you take care, next time you post here, to quote what you are replying
to.
Actaully I want to disable the back and forward buttons.

I thought it might be something as supid as this.

Forget it. Anything you try is doomed to failure.
I tried many method like
1. history.forward(1);
2. var Backlen=history.length;history.go(-
Backlen);window.location='newPage.html';
3. Opening a new window.

But the first 2 methods are not fitting for me. So i have chosen the
3rd option.
if you know any other better option, that will also work for me.

There is a fourth option: Leave the users browser functions alone. If you
have cause to try to interfere with the way *my* browser works then *your*
design is flawed.
 
B

boss

Would you take care, next time you post here, to quote what you are replying
to.


I thought it might be something as supid as this.

Forget it. Anything you try is doomed to failure.



There is a fourth option: Leave the users browser functions alone. If you
have cause to try to interfere with the way *my* browser works then *your*
design is flawed.

I am not getting your point. Can you explain in detail?
 
R

rf

boss said:
I am not getting your point. Can you explain in detail?

The back and forward buttons are part of the browsers user interface. They
are not part of the browsers canvas.

The canvas is where you, as a web developer, draw your page.

Leave the rest of the browser (everything, for your purposes, that outside
your <body> element) right alone.

Some time ago, last century, certain browsers allowed you to influence the
*browsers user interface*. You were allowed to change the browser windows
size and perhaps position. You cannot do this any more.

You also cannot, from a spawned window, close the "parent" window. Except in
IE if you exploit an IE bug.

Bottom line: Stop wanting what you want to do.

You did not answer my question, which you omitted to quote so I will repeat
it, slightlyi altered:

Why do you want to do this? That is, why do you want to disable these
browser functions?
 
S

Stevo

boss said:
I am not getting your point. Can you explain in detail?

His point seems pretty clear. I think you need to explain in detail why
you're trying to do these things you want to do. Then someone can
explain why it's the wrong thing to do.

If you're trying to solve a problem caused by your design, then some
redesign tips would be better than tips on how to work around the
problem it's caused.
 
R

rf

Conrad said:
I agree, it's generally a bad idea. On the other hand, I don't know
why he's trying to do it; there may be a reason. In web applications,
the ability to go back to a previous state (which may no longer be
valid), is sometimes not desirable. The application logic can and
should deal with this, but if history navigation really has to be
completely disabled (for whatever reason), his best bet would be a
user agent like Mozilla Prism. Other web apps (netbanking, for
example) use incremental request numbers, and if they receive a
request with a lower or equal number, they display an error page.

If the OP is writing a "web application" that cannot allow for the use if
the back and fowrard buttons that every browser provides then the OP should
either redesign the application or chose, as you suggest, something other
than a browser as the UA.
Anyway, opening and closing windows to disable the history would be
insane.

Indeed.
 
B

boss

I agree, it's generally a bad idea. On the other hand, I don't know why
he's trying to do it; there may be a reason. In web applications, the
ability to go back to a previous state (which may no longer be valid),

I donno how to handle this issue through application logic..
If u share ur knowledage that would be appreciated..
I am using java language..if u have any link which talks about this
issue, pls share it.
 
R

rf

boss said:
I am using java language

In that case you are in the wrong newsgroup.

Java has nothing at all to do with javascript, just as a car has nothing to
do with a carpet.

However the general consensus of this thread still remains.

Don't do this. Now, which part of "don't do this" do you fail to understand?
 
R

rf

boss said:
I donno how to handle this issue through application logic..
If u share ur knowledage that would be appreciated..
I am using java language..if u have any link which talks about this
issue, pls share it.


Can you not speak real English, as the English, or the Americans or us
Australians, amongst others, speak it?

u?
ur?
pls?

Good luck in your venture.
 
S

Stevo

rf said:
In that case you are in the wrong newsgroup.

Java has nothing at all to do with javascript, just as a car has nothing to
do with a carpet.

Oh man, that's a classic. I'll be quoting that one somewhere sometime
I'm sure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top