open page in new window

B

Bechtle

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
 
E

Erwin Moller

Bechtle said:
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
 
B

Bechtle

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
 
G

Gérard Talbot

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
</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
 

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,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top