By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,805 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

open page in new window

P: n/a
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

Jan 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
Jan 26 '06 #2

P: n/a
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

Jan 26 '06 #3

P: n/a
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
Jan 28 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.