473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open new window using Javascript or Hyperlink

I am trying to open a new window in two ways
1 - adding javascript to the onclick attribute of an Image button to open a
pdf document in a new window as
javascrit:windo w.open('MyPage. aspx',status=1, location=1,resi zable=yes,scrol lbars=yes)

2 - I am using a HyperLink and using the NagigateUrl property to open a pdf
in a new window with the targer set as "_Blank"

The trouble I am having is trying to keep the focus on the new window.
Sometimes it opens with the focus then almost immediately loses focus. Some
time it opens but does not have focus . It is not minimized just loses focus.
THe behavoir is inconsistent

How can i prevent this
Do i use the respone object
With Response
.ClearContent()
.ClearHeaders()
.ContentType = "applicatio n/pdf"
.Buffer = True
.WriteFile(strF ileName)
.Flush()
.Close()
End With

Any ideas or suggetsions will be appreciated.
Jawahar
Nov 19 '05 #1
2 7344
window.open returns a reference to the new window. Could you focus it that
way?

javascript: newWindow = window.open( '...' ); newWindow.focus ();

bill

"Jawahar" <Ja*****@discus sions.microsoft .com> wrote in message
news:72******** *************** ***********@mic rosoft.com...
I am trying to open a new window in two ways
1 - adding javascript to the onclick attribute of an Image button to open a pdf document in a new window as:
javascrit:windo w.open('MyPage. aspx',status=1, location=1,resi zable=yes,scrol l
bars=yes)
2 - I am using a HyperLink and using the NagigateUrl property to open a pdf in a new window with the targer set as "_Blank"

The trouble I am having is trying to keep the focus on the new window.
Sometimes it opens with the focus then almost immediately loses focus. Some time it opens but does not have focus . It is not minimized just loses focus. THe behavoir is inconsistent

How can i prevent this
Do i use the respone object
With Response
.ClearContent()
.ClearHeaders()
.ContentType = "applicatio n/pdf"
.Buffer = True
.WriteFile(strF ileName)
.Flush()
.Close()
End With

Any ideas or suggetsions will be appreciated.
Jawahar

Nov 19 '05 #2
Do you have smart navigation turned on? This caused me problems and I
have to rewrite a pieve of the smartnav script.

"=?Utf-8?B?SmF3YWhhcg= =?=" <Ja*****@discus sions.microsoft .com> wrote in
news:72******** *************** ***********@mic rosoft.com:
I am trying to open a new window in two ways
1 - adding javascript to the onclick attribute of an Image button to
open a pdf document in a new window as:
javascrit:windo w.open('MyPage. aspx',status=1, location=1,resi zable=yes,s
crollbars=yes)

2 - I am using a HyperLink and using the NagigateUrl property to open
a pdf in a new window with the targer set as "_Blank"

The trouble I am having is trying to keep the focus on the new window.
Sometimes it opens with the focus then almost immediately loses focus.
Some time it opens but does not have focus . It is not minimized just
loses focus. THe behavoir is inconsistent

How can i prevent this
Do i use the respone object
With Response
.ClearContent()
.ClearHeaders()
.ContentType = "applicatio n/pdf"
.Buffer = True
.WriteFile(strF ileName)
.Flush()
.Close()
End With

Any ideas or suggetsions will be appreciated.
Jawahar


Nov 19 '05 #3

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

Similar topics

18
8856
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page (same folder). The cookie is not received. Can someone explain why? I worked around this by adding a cache-control header with a value of no-cache. This fixes the problem. Unfortunately that causes another problem with Internet Explorer...
40
10844
by: Brian Jorgenson | last post by:
On my web page, I have a few hyperlinks with target frame of _blank. The hyperlink brings up a second window, but everytime I click on thie hperlink, it keeps bringing up a new window and not defaulting the the first active window. How do I make a hyperlink point to the active window? I don not want the hyperlink to default to the same page. I do want a second window but only a second window and not multiple pages.
4
19614
by: Olav Tollefsen | last post by:
I have an <asp:Hyperlink> in my .aspx file. How can I configure it to open the URL (NavigateURL) in a popup window instead of a new normal browser window. I use Target="_blank", but didn't find other values to specify a popup window. Olav
4
2792
by: KenG | last post by:
Hi: I have a datagrid that builds a hyperling which uses javascript to open a new window. The new window opens and displays fine, however, the original window that has the grid, is now blank with only "" displayed in an otherwise empty window. To restore the datagrid in that window, I have to use the browsers "back" button. How can I stop the parent window from changing?
8
4368
by: Dan | last post by:
hello all, is there a way to open a new window without javascript and a href=_blank? i need to connect a button click with some lines of code and then, a new window shall get opened. but i didn't find a way to opüen a new window as result of a buttonm click. thanks for help, dan
5
2535
by: Chris | last post by:
Hello, I have a link on an aspx page. The URL is set in the Page Load event: lnkEventHistory.NavigateUrl = "javascript:window.open('EventHistory.aspx?TeenID=" & _ Request.Item("SubjectID") & "&EventCode=" & Request.Item("EventCode") & "')" When I click the link, the new window opens as expected. The problem is
9
2864
by: loga123 | last post by:
I am using asp .net 2.0. I have a hyperlink asp control on my web page page1.aspx. On clicking this hyper;link, I would like to open page2.aspx (which is in the same web application) in a new IE window without scrollbars, status bar, tool bar and with specified height and width. Can it be done on "onload" event of the page2.aspx in javascript?
9
3160
by: smokeyd | last post by:
hi, can anyone tell me how to open a link in a new browser window in vbscript.net. i am looking to be able to set the properties such as size, menu bar, scroll bar etc. or alternativelly is there a simple way to do this in visual web developer? many thanks in advance for your help.
6
12081
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the link.actually i 'm using link button control to diplay the hyperlinks.i cant use java script "window.open()".i need some server side code behind the linkbutton,if any one knows plz rply soon.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.