Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > open page in new window

Reply
Thread Tools

open page in new window

 
 
Bechtle
Guest
Posts: n/a
 
      01-26-2006
Hi googlers


I'm creating a portal on MS Office Portal Server. Unfortunaterly
there's no way to open a link of the navigation in a new window.


Now I'm trying to create a homepage with a webpart which contains a
forwarding to a homepage. The page has to be opened in a new window.
Unfortunately I don't know JavaScript, please help me


I found in the internet some solutions, but I can't understand
everything. At the moment my code looks like that:


<html>
<head><title>Test</title>
<script type="text/javascript">
function OpenWin (Adresse) {
Fenster1 = window.open("http://localhost/asp", "testlink.htm");
Fenster1.focus();
}
</script>
</head>
<body>
<a href="testlink.htm" onclick="OpenWin(this.href); return false">open
link in new window</a>
</body>
</html>

Path of the file is: C:\inetpub\wwwroot\asp\weiterleitung.htm
localhost is C:\inetpub\wwwroot


what's wrong?


Thanks a lot for your help


Regards
Michael

 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      01-26-2006
Bechtle wrote:

> Hi googlers


I am not a googler, this is usenet (newsgroups).
You are just using Google to get in.

>
>
> I'm creating a portal on MS Office Portal Server. Unfortunaterly
> there's no way to open a link of the navigation in a new window.
>
>
> Now I'm trying to create a homepage with a webpart which contains a
> forwarding to a homepage. The page has to be opened in a new window.
> Unfortunately I don't know JavaScript, please help me
>
>
> I found in the internet some solutions, but I can't understand
> everything. At the moment my code looks like that:
>
>
> <html>
> <head><title>Test</title>
> <script type="text/javascript">
> function OpenWin (Adresse) {
> Fenster1 = window.open("http://localhost/asp", "testlink.htm");
> Fenster1.focus();
> }
> </script>
> </head>
> <body>
> <a href="testlink.htm" onclick="OpenWin(this.href); return false">open
> link in new window</a>
> </body>
> </html>


Well, I don't think you need Javascript at all.

did you try:
<a href="http://localhost/asp/testlink.html" target="myPortalThingy">open
link in new window</a>

And if you insist using javascript (which can be usefull to give the new
window a desired position and width and height), try:

<script type="text/javascript">
function OpenWin (Adresse) {
var theURL = "http://localhost/asp/"+Adresse;
var Fenster1 = window.open(theURL, "thisisthewindowname");
Fenster1.focus();
}
</script>

You forgot to add the 'Adresse" to the path.

>
> Path of the file is: C:\inetpub\wwwroot\asp\weiterleitung.htm


That is not important for hyperlinks. They use the webroot as startingpoint,
not a filesystem-path.

> localhost is C:\inetpub\wwwroot
>
>
> what's wrong?
>
>
> Thanks a lot for your help
>
>
> Regards
> Michael



Regards,
Erwin Moller


 
Reply With Quote
 
 
 
 
Bechtle
Guest
Posts: n/a
 
      01-26-2006
Hi Erwin

Thanks for your help. But unfortunately that solution doesn't work.The
problem is, that i can't edit a link of the navigation in sharepoint.

So I have to edit the page where the Link is linked to and create a
automatic forward to the page I want to get. (i hope you understand, my
english isn't very well)

unmeant I posted my question first to it.comp.lang.javascript-group
(it=Information Technologie ), so I got already an answer. Thanks a
lot for your help anyway.

Regards
Michael

 
Reply With Quote
 
Gérard Talbot
Guest
Posts: n/a
 
      01-28-2006
Bechtle wrote :
> Hi googlers
>
>
> I'm creating a portal on MS Office Portal Server. Unfortunaterly
> there's no way to open a link of the navigation in a new window.
>
>
> Now I'm trying to create a homepage with a webpart which contains a
> forwarding to a homepage. The page has to be opened in a new window.


Has to? Why? What about text browsers, tv browsers, PDA and other
web-aware applications which can not open another instance of the
application?

> Unfortunately I don't know JavaScript, please help me
>
>
> I found in the internet some solutions, but I can't understand
> everything. At the moment my code looks like that:
>
>
> <html>


First start with a doctype declaration. Since you are going to be using
the target attribute, then you need a transitional DTD:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Recommended DTDs to use in your Web document.
http://www.w3.org/QA/2002/04/valid-dtd-list.html

> <head><title>Test</title>
> <script type="text/javascript">
> function OpenWin (Adresse) {
> Fenster1 = window.open("http://localhost/asp", "testlink.htm");
> Fenster1.focus();
> }


<script type="text/javascript">
var WindowObjectReference; // global variable

function openRequestedSinglePopup(strUrl, strWindowName)
{
if(WindowObjectReference == null || WindowObjectReference.closed)
{
WindowObjectReference = window.open(strUrl, strWindowName,
"resizable=yes,scrollbars=yes,location=yes,status= yes");
}
else
{
WindowObjectReference.focus();
};
}
</script>
(...)

<p><a href="testlink.htm" target="SingleSecondaryWindowName"
onclick="openRequestedSinglePopup(this.href, this.target); return
false;" title="This link will create a new window or will re-use
an already opened one">Some descriptive words about the linked
resource</a></p>


> </script>
> </head>
> <body>
> <a href="testlink.htm" onclick="OpenWin(this.href); return false">open
> link in new window</a>
> </body>
> </html>
>
> Path of the file is: C:\inetpub\wwwroot\asp\weiterleitung.htm
> localhost is C:\inetpub\wwwroot
>
>
> what's wrong?



You did wrong by having a dot in the windowName (testlink.htm) and you
did not make any use of the function parameter (Adresse)

You can learn more and get more explanations here:

DOM:window.open()
http://developer.mozilla.org/en/docs/DOM:window.open

Gérard
--
remove blah to email me
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Window.Open get new tab instead of new window in FireFox Fredzidd@gmail.com Javascript 1 02-29-2008 03:06 AM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
Need to open a new browser window, not a new window Gordon ASP General 3 04-16-2004 10:46 PM
open window a new window and retrieve data from it. C# Cheryl ASP .Net 2 11-12-2003 05:30 AM
How can I open a new window and ensure the page loaded creates a NEW session? Jazzis ASP General 4 09-26-2003 06:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57