opening hyperlinks in new windows - again

A

Alison

Hi there,
This seems to be an ongoing issue for Publisher so I am surprised after 7,
8, 10 years they have not got round to creating a solution for this. But
anyway, I have tried to follow the instructions to hyperlink so that it opens
in new window. When the hyperlink window opens, as an example, I put in this
code: <a target="_blank"
href="http://www.1shoppingcart.com/app/join.asp?MerchantID=140801">Link
Text</a>

Then when I check the file and click, it says page can't be found.

Yet if I keep the hyperlink as
http://www.1shoppingcart.com/app/join.asp?MerchantID=140801, the hyperlink
works fine but doesn't open in a new window.

Maybe it is because I am hyperlinking an image I don't know. Yet
hyperlinking the image seems to work if I don't care that it opens in the
same window.

I know you must be very very tired of answering this question, but could you
please try one more time, and answer it in a way that a non-techy person can
understand? Thanks for your help.
 
M

MAURH

Alison,

I have a feeling that the first javascript code snippet on the Microsoft
website is incorrect.

However, if you are using Publisher 2003, as I am, this is the method and
code that I use to open hyperlinks in a new window. So far I have only used
it to open other websites in a new window, but no doubt it can be used for
other hyperlinks.

Open your Pub. doc. to the page on which you wish to place your hyperlink
...go to >Insert >HTML Code fragment. The box should drop down and into it
you put this code:

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>

you can highlight it and then copy and paste, Ctrl V, it from here. Click
OK and a box will appear on your website page. Place this box anywhere on
your page that won't overlap any other feature....and you can make it as
small as you like and you only need to do it once on that page.

Type the name you want to hyperlink on your page, highlight it and go to
'Insert Hyperlink' and in this box you insert this code into the address
field:

javascript:Show('http://*****/','newwindow','')

again you can copy and paste it from here. Delete the stars ***** and
replace with the website address you wish to link to. Click OK and when you
do a preview and click on the link, it should open in a new window.

As I have quite a few links like this, I save this code, with the stars, in
notepad and then when I need it, I just delete the stars, add the new
website address and copy and paste it into the address field.

This may work for other versions as well as 2003, I don't know, but if this
is not what you're looking for, I'm sure someone else will be along soon to
help.

Maureen
 
S

Spike

I am using the following with no problem:


Using the insert html code fragment feature,

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url); }</script>



Then insert text or image into your page, right click, insert hyperlink, and
paste the following in the hyperlink dialog:

javascript:Show('http://www.mydomain.com/','')


Spike
 
D

DavidF

Which version of Publisher are you using? Your code snippet works fine for
me in Pub 2003 and 2007, but if you overlap an image with a code fragment
box in Pub 2000, it won't work. If you layer or overlap objects in Pub 2000,
they are combined into a new combined image, and killing the link. If you
put the code fragment box directly below or above the image, much as you
would a caption, and don't overlap it, then it should work.

If you follow the link Spike gave you, the article discusses two ways of
opening a new window. If you are using Pub 2000, and want to use your html
method, then you will need to follow the instructions for applying the
hyperlink to a picture at the bottom of the page, which involves importing
the image into the page along with the link.

If you just want to be able to click an embedded image and open a new
window, then the ECMAScript code approach described on the same page, and as
MAURH describes is probably easier and more versatile. And she is correct
that there is an error on the page. In the ECMA section, under item 2, the
author says to insert the following code snippet into your page via a code
fragment box:

<script language="JavaScript" type="text/javascript">
<!--
function Show(Url, Name, Features)
{
window.open(Url, Name, Features);
}
// -->
</script>

-------------------

As MAURH suggests, use this snippet instead:

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>

You can't use the 'comment out' code part of the original code snippet:

// -->

------------------

I also like MAURH workflow of building the code snippets in a text file in
NotePad...or perhaps a text box that you put in the scratch area of your Pub
page. Then if you use the ECMA approach, you can just copy the javascript
code snippets for the new links, select an image or text in all versions of
Publisher, right click, hyperlink, and Ctrl + V to paste the code snippet
into the address field of the hyperlink dialog.

Now, between the three of us, does this fix your problem? <g>

DavidF
 
A

Alison

PS I'm using Publisher 2003

DavidF said:
Which version of Publisher are you using? Your code snippet works fine for
me in Pub 2003 and 2007, but if you overlap an image with a code fragment
box in Pub 2000, it won't work. If you layer or overlap objects in Pub 2000,
they are combined into a new combined image, and killing the link. If you
put the code fragment box directly below or above the image, much as you
would a caption, and don't overlap it, then it should work.

If you follow the link Spike gave you, the article discusses two ways of
opening a new window. If you are using Pub 2000, and want to use your html
method, then you will need to follow the instructions for applying the
hyperlink to a picture at the bottom of the page, which involves importing
the image into the page along with the link.

If you just want to be able to click an embedded image and open a new
window, then the ECMAScript code approach described on the same page, and as
MAURH describes is probably easier and more versatile. And she is correct
that there is an error on the page. In the ECMA section, under item 2, the
author says to insert the following code snippet into your page via a code
fragment box:

<script language="JavaScript" type="text/javascript">
<!--
function Show(Url, Name, Features)
{
window.open(Url, Name, Features);
}
// -->
</script>

-------------------

As MAURH suggests, use this snippet instead:

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>

You can't use the 'comment out' code part of the original code snippet:

// -->

------------------

I also like MAURH workflow of building the code snippets in a text file in
NotePad...or perhaps a text box that you put in the scratch area of your Pub
page. Then if you use the ECMA approach, you can just copy the javascript
code snippets for the new links, select an image or text in all versions of
Publisher, right click, hyperlink, and Ctrl + V to paste the code snippet
into the address field of the hyperlink dialog.

Now, between the three of us, does this fix your problem? <g>

DavidF
 
A

Alison

I am going to have to print these all out and work through them one by one to
see which works best.
In the meantime, I figured out what I did wrong in the first one (there was
an extra space) and got text links and image links working to open in new
window. There doesn't seem to be a way of formatting it at all though except
if you create an image that you use for the html code. (I may sound like I
know what I'm doing, but I only do a little bit LOL!).
How does this work for an mp3 file? Right now for example at
mywritingonline.com on the music page I have links to listen to sample mp3
tracks. Is there a way to easily have these open in a new window too?
And I'm not sure about java script stuff - I've never used it to my
knowledge. I've only ever used the "insert html code" feature.
Thanks again for all your suggestions.
Alison
 
D

DavidF

Glad you found your error. That is one of the advantages of writing your
links in a NotePad text file, or a separate text box in the scratch area of
your Publisher document. You can more easily proof read it, and save an
example of a working link to modify in the future.

You can "format" the new browser window. Read through the examples on the
page Spike linked, and the attributes table. Once again, adding attributes
in your code string is easier if you do it on the side rather than directly
in the address field of the hyperlink dialog box.

MP3 files? I wouldn't set them to open in a new window. I would add text to
give the viewer the instructions on how to download the files to their local
computer and then play the mp3 files with whatever player they have on their
computer: "To play sample tracks please right click on the download link and
choose "Save Target As..." or something like that. MP3 files are not web
pages to be opened in a browser window. They are external files and you
might want to put them into a separate folder on your host to keep them
organized: Including external files in a Publisher web:
http://msmvps.com/blogs/dbartosik/archive/2006/01/07/80561.aspx

DavidF
 
A

Alison

Thanks very much everyone for your help! It's been quite the learning
experience. Still, I find Publisher so much easier to use than other web page
development software - at least from the point of view of a non techy person!
Thanks
Alison
 

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

Top