0

I have a link "help". Upon clicking the help link, the content has to be displayed in a new tab or in a new full window.If I am passing a link,say "google.com",the link is opened in a new tab but I am passing a htm file.So I'm getting the content in a pop-up. How can I avoid this and how can I get the content in new full window or tab? Could anyone help me in this? Thanks in advance.

My code:

var newtab=window.open();
newtab.location=a_pszHelpFile;

I also tried this:

var win=window.open(a_pszHelpFile, '_blank');
 win.focus();

Things which I tried:

window.onload = window.open(a_pszHelpFile, "__webCshStub", "width=1000,height=1000");


window.open(a_pszHelpFile, "__new", "width=1000,height=1000");

When I used this, a small window pops up.

 window.open(a_pszHelpFile, "_blank");

If I specify the width and height, this is what I get. enter image description here

How to get the content in a new tab?

mukund
  • 317
  • 5
  • 10
  • 22
  • I guess this can help you out ,http://stackoverflow.com/questions/1580987/how-to-open-a-new-window-when-clicking-a-hyperlink – dreamweiver Jun 04 '13 at 11:32
  • The code which you have used if fine, just that the window size is set to default, so you just need to pass the length and width as a parameter to `window.open()` method. – dreamweiver Jun 04 '13 at 11:36
  • http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab – Pete Jun 04 '13 at 11:39
  • Avoid using `_new` as per html techinical specifications its an invalid keyword, which shouldnt be use. as far as browser is concerned, it will bahave same way with `new` keyword. **REFERENCE:** http://stackoverflow.com/questions/4964130/target-blank-vs-target-new – dreamweiver Jun 04 '13 at 11:41
  • @pete:There is no difference with respect to browser, whether its a new tab or a new window,because in either case new instance of the browser would be created. – dreamweiver Jun 04 '13 at 11:43
  • I tried from the link which u sent me. But still i am getting only a new popup. – mukund Jun 04 '13 at 11:44
  • what do you mean by 'popup'? download file dialog pops up? – Jude Duran Jun 04 '13 at 11:45
  • The code that you have given is fine. For a trial purpose try with some full url like this [jsfiddle](http://jsfiddle.net/T2SkB/). – Rohith Gopi Jun 04 '13 at 11:45
  • Actually when I pass the width and height,I am getting a blank window with that width and height and above that window I am getting popup showing the content. – mukund Jun 04 '13 at 11:50
  • Please update your post and show us what you have tried with the above suggestions – Jude Duran Jun 04 '13 at 11:54

1 Answers1

1

I tried this without any properties (just the url) and it opened in a new tab

window.open(a_pszHelpFile);

See if this works for you too

Jude Duran
  • 2,195
  • 2
  • 25
  • 41
  • User already said that he tried with this code and the window size is small(default size). he is expecting something as big as the regular browser window,for which you need to pass the height and width. – dreamweiver Jun 04 '13 at 11:45
  • But when I tried it does not open in a new tab. It opened in a new small window like a popup – mukund Jun 04 '13 at 12:32
  • I tried it in IE and it still works..:/ What version of IE are you using? – Jude Duran Jun 04 '13 at 12:35