How to open url in new window and use previous window when already opened

We can achieve this by using a simple javascript function....

    var WindowObjectReference;
function openRequestedSingleWindow(strUrl, strWindowName)
{
    if(WindowObjectReference == null || WindowObjectReference.closed)
   {
     WindowObjectReference = window.open(strUrl, strWindowName);
   }
   else
   {
     WindowObjectReference.focus();
   }
}

Here we use a WindowObjectReference as a global variable to track the opened window. If opened for the first time we open in a new window or else if already opened, we focus to that window.

<a href="some url.htm" id="window name" target="anyName" onClick=openRequestedSingleWindow(this.href, this.target) >Click Link </a>




My Dream is to be in your Dreams...
http://eshwar123.blogspot.com
0
eshwar
8/3/2006 7:08:30 AM
asp.net.client-side 24353 articles. 1 followers. Follow

1 Replies
1142 Views

Similar Articles

[PageSpeed] 3

Well, to achieve this (opening a popup or focusing it if already open) you just need the following, and use the same target:

   function openRequestedSingleWindow(strUrl, strWindowName)
      window.open(strUrl, strWindowName).focus();
   }

Btw, i guess you better post this kind of contributions to the Tips & Tricks forum...

Regards. -LV


Julio P. Di Egidio
Software Analyst Programmer
=BUSINESS AND SCIENTIFIC=
=SOFTWARE DEVELOPMENT=
http://julio.diegidio.name

(Peace X Love] = [++1)
0
LudovicoVan
8/3/2006 2:52:22 PM
Reply:

Similar Artilces:

PDFS open in new window, used to open in FF window with URL showing
I don't recall changing anything except maybe the application Firefox is supposed to use for PDFs, from Adobe to Foxit Reader. If When I opened PDF files from the address bar I used to still have the address bar showing. This was handy for calling up IRS forms, then changing the "f" in the address bar to "i" to call up the instructions. Now, at least with Foxit Reader, it opens in a separate window without showing the actual URL downloaded in the Firefox address bar. It used to open in the same window as I recall, showing the address of the downloaded file. ...

OPEN NEW WINDOW USING window.open
Hi, can any eagle eyed geniuses spot what I'm doing wrong here? It's doing my nut! I'm simply trying to call a new page in a new window that I want to control the size, etc. I've tried two different ways - one from within my code behind and the other triggered by a LinkButton command action. Both do absolutely nothing. Please help... Private Sub InfoClick1(ByVal pSiteCode) Response.Write("<script>window.open('siteinfo.aspx?sitecode='" & pSiteCode & "','Info','left=20,top=20,height=500,width=850,toolbar=no,status=no,resizable=1,scrollbars=no')</script>") End Sub +...

open a new pop-up window having a pop-up window already open....
Hi all, pls help I have done coding to open a pop window, its opening without any problem, now I want to open an new pop-up window keeping the older pop-up open, currently as I try to open page in the new pop-up, the page is displayed in the older pop up window instead of showingin a new pop-up window. Please help in this regard Thanks  Avaneesh Bajoria Hi,you popup window objects may be overwritten... post your code... VasanthakumarSoftware Engineer.  hi!use different titles for each window:        var i =0;    &nb...

open a new pop-up window having a pop-up window already open...
Hi All, Please help, I am opening a pop-up window using the following statement IN JAVASCRIPT: function openSLST() { window.open("pgnew.aspx",null,"height=700,width=800,status=no,toolbar=no,menubar=no,location=no,left=5,top=5,scrollbars=yes"); }  the above function is called as below withiin a <tr></tr> tag : <a runat="server" id="aslst" class="avilink" onclick="openSLST();" href="#">AviList</a> a new window pops up so far so good.... now when i try to open a new pop-up(i want the p...

Open a new window with window.open()
Hi, =20 in our web application, we try to open a popup-window with window.open(). But instead of opening a new window, a new tab is opened. =20 In the SeaMonkey preferences, we configured it, to open new links in a new tab. With firefox, we had the same preferences, but when window.open() was called, a new window was opened.=20 How can we configure SeaMonkey, so that it has the Firefox behavior when calling window.open() ? =20 Thanks in advance. =20 =20 =20 Artur Zeiler schrieb: > Hi, > > in our web application, we try to open a popup-window wi...

opening new window other than window.open
is there any other way of opening a new window... aside from window.open? window.open has a memory leak so i want to prevent using it as much as possible.Alvin ShihSoftware DeveloperMCP MCTS MCPD Hi window.showmodaldialog() but supports only IE....   Regards Suresh Kumar Goudampally Why dont you avoid pop up windows all together and use an iframe that is positioned over the content? Eric Pascarello.com | Twitter epascarello | LinkedIn Hi,Try Target="_blank" N.P.SenthilSoftware Engineer  Link buttons targer property is set to "_blank"...

automatically adjusting the new window size opened using window.open()
i am using window.open() javascript method specifying the height and width of the new window. but the problem is the contents are bit bigger than that, they will be invisible and if they are less, there will be blank white screen which doesn't look very good. so is it possible to adjust the size of new window automatically depending upon the content?-keeara g------------------ Hi keeara, Use window.resizeTo(iWidth, iHeight). Cheers, Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early. but can i access it by server side code? i am using vb.n...

superreview requested: [Bug 172962] Options for where to open URLs from other applications (reuse tab, new tab, new window) : [Attachment 159443] optional addition to divert window.open to a new tab
Dan M <danm.moz@gmail.com> has asked Peter Van der Beken <peterv@propagandism.org> for superreview: Bug 172962: Options for where to open URLs from other applications (reuse tab, new tab, new window) https://bugzilla.mozilla.org/show_bug.cgi?id=172962 Attachment 159443: optional addition to divert window.open to a new tab https://bugzilla.mozilla.org/attachment.cgi?id=159443&action=edit ...

superreview granted: [Bug 172962] Options for where to open URLs from other applications (reuse tab, new tab, new window) : [Attachment 159443] optional addition to divert window.open to a new tab
Peter Van der Beken <peterv@propagandism.org> has granted Dan M <danm.moz@gmail.com>'s request for superreview: Bug 172962: Options for where to open URLs from other applications (reuse tab, new tab, new window) https://bugzilla.mozilla.org/show_bug.cgi?id=172962 Attachment 159443: optional addition to divert window.open to a new tab https://bugzilla.mozilla.org/attachment.cgi?id=159443&action=edit ------- Additional Comments from Peter Van der Beken <peterv@propagandism.org> >Index: dom/src/base/nsGlobalWindow.cpp >=================================...

superreview granted: [Bug 172962] Options for where to open URLs from other applications (reuse tab, new tab, new window) : [Attachment 161419] don't divert window.open to a new tab if the named wind
Johnny Stenback <jst@mozilla.jstenback.com> has granted Dan M <danm.moz@gmail.com>'s request for superreview: Bug 172962: Options for where to open URLs from other applications (reuse tab, new tab, new window) https://bugzilla.mozilla.org/show_bug.cgi?id=172962 Attachment 161419: don't divert window.open to a new tab if the named window exists https://bugzilla.mozilla.org/attachment.cgi?id=161419&action=edit ------- Additional Comments from Johnny Stenback <jst@mozilla.jstenback.com> sr=jst ...

superreview requested: [Bug 172962] Options for where to open URLs from other applications (reuse tab, new tab, new window) : [Attachment 161419] don't divert window.open to a new tab if the named wi
Dan M <danm.moz@gmail.com> has asked Johnny Stenback <jst@mozilla.jstenback.com> for superreview: Bug 172962: Options for where to open URLs from other applications (reuse tab, new tab, new window) https://bugzilla.mozilla.org/show_bug.cgi?id=172962 Attachment 161419: don't divert window.open to a new tab if the named window exists https://bugzilla.mozilla.org/attachment.cgi?id=161419&action=edit ...

window.open() opens new window
Firefox 19.0 Windows XP Pro SP-3 Example site URL: http://www.pcconnection.com/ (I've hit this problem at many sites, however.) Firefox is configured (enabled) as: Tools -> Options -> Tabs "Open new windows in a new tab instead" = Enabled Presumably this means when a page tries to open a new window (another instance of the web browser) that instead a new tab will appear in the current window. Works that way in IE8 (when "Always open popups in a new tab" is enabled). Go down the page and click on the "Site Help" link. What I get...

how can I use window.opener but with window.showModalDialog instead of window.open
Hi, I tried the code bellow that I found in  :  4guysfromrolla site:the code displays a source page, whn I click on the Calendar <a href />  link  i get a calendar displayed on a target page. when I select a date, the calendar page closes and populates the textbox txtDate with the chosen date. Here is the code of the 2 pages and my question is down bellow:a source page called frmCalendar.aspx has this:<form name="frmCalendar">   <input name="txtDate" type="text" />   <a href=&q...

Problem with opening new window "window.Open" using javascript
I am trying to open new window when press a button "btnPrint" using: Response.Write("<script language='javascript'> window.open('CouponReport.aspx', 'window', 'HEIGHT=600,WIDTH=820,top=50,left=50,toolbar=yes,scrollbars=yes,resizable=yes'); </script>"); but when the new window opened the current page do a post back action and the current page format change like the following: before window open: after window opened: So, how i can a void the post back action.  <script language='javascript'> funct...

Web resources about - How to open url in new window and use previous window when already opened - asp.net.client-side

List of Presidents of the United States by previous experience - Wikipedia, the free encyclopedia
Although many paths may lead to the Presidency of the United States , the most common job experience, occupation or profession of U.S. presidents ...

Lish.com comes out of beta with 2x visitors and 3x engagement of Payvment’s previous f-commerce app
... and best practices for social shopping. Lish.com, which launched in beta in August , receives twice as many daily visitors as Payvment’s previous ...

CET and HadCRUT v3 vs previous SCL (since 1854) - Flickr - Photo Sharing!
Graph of previous solar cycle length (X axis) vs averaged annual temperature anomaly during the following solar cycle (Y axis). CET has only ...

Wheat and chaff: Arabian Gulf's previous attempts of cultivating crop
Concerns about food security have prompted trials of wheat cultivation. But previous attempts to grow the crop in the region have not fared well. ...

China set for 20 gigawatts of solar after first quarter splurge doubles previous year
Solar capacity in China doubled in the first quarter, putting the world's largest market on track to exceed its goals for the year, according ...

Vince Colosimo caught twice driving on a previous suspension
He's played a police officer on more than one occasion but this time Vince Colosimo has found himself on the wrong side of the law.


Duncan Gay's licence plan for cyclists goes against previous departmental advice
Forcing cyclists to take out a licence, as proposed by Duncan Gay, would put ''substantial'' costs on families and probably be ineffective in ...

Two Mr Fluffy homes sell for well below their previous worth
Two Mr Fluffy homes that sold recently for well below their previous worth show the extent to which the asbestos crisis is affecting house values. ...

Previous form counts for nothing in Asian Cup, says Socceroos defender Jason Davidson
He might have been one of Australia's best performers at the 2014 World Cup, but talented defender Jason Davidson concedes that will count for ...

Resources last updated: 1/1/2016 7:35:22 AM