How do I prevent Word from adding target="_BLANK" to half my links

B

Barbara

I have 4 documents all created in Word 2000. All four contain the sentence,
"If the video does not play, please download Shockwave." Here, "Shockwave" is
a link to http://www.adobe.com/shockwave/download/. I opened each document in
Word 2003 and saved it as a web page (filtered). In two of the four
documents, the HTML source for the link reads:

<a href="http://www.adobe.com/shockwave/download/">Shockwave</a>.

In the other two documents, it reads:

<a href="http://www.adobe.com/shockwave/download/"
target="_BLANK">Shockwave</a>.

When I ask to edit these hyperlinks in Word 2003, they all look identical to
me. Specifically, the target frame for all four is set to "Page default
(none)."

What else can I look at to try to figure out why the links are coming out
differently from each other?

(I need to do a little post-processing on these links to make them run some
javascript. The javascript does not work if the links include target=_blank.
So I want Word not to put it there in the first place.)

Thanks!
 
R

Robert M. Franz (RMF)

Hello Barbara
I have 4 documents all created in Word 2000. All four contain the sentence,
"If the video does not play, please download Shockwave." Here, "Shockwave" is
a link to http://www.adobe.com/shockwave/download/. I opened each document in
Word 2003 and saved it as a web page (filtered). In two of the four
documents, the HTML source for the link reads:

<a href="http://www.adobe.com/shockwave/download/">Shockwave</a>.

In the other two documents, it reads:

<a href="http://www.adobe.com/shockwave/download/"
target="_BLANK">Shockwave</a>.

When I ask to edit these hyperlinks in Word 2003, they all look identical to
me. Specifically, the target frame for all four is set to "Page default
(none)."

What else can I look at to try to figure out why the links are coming out
differently from each other?

(I need to do a little post-processing on these links to make them run some
javascript. The javascript does not work if the links include target=_blank.
So I want Word not to put it there in the first place.)

Word, especially in 2000, was not up to creating "pretty" HTML code.

When creating a hyperlink by itself (AutoFormat As You Type option),
then I'm pretty sure you get the first (direct link) version.

The "opening in a new window" can be set as an option when creating the
link through Insert | Hyperlink. There's no way reading this other than
in the source, once you've converted to HTML. Best thing is to do your
post-processing in a code or text editor (or open the files in Word as
raw text), then this should not bother you.

HTH
Robert
 
B

Barbara

Thanks for your answer, Robert. If I understand you correctly, it is simply
unpredictable whether Word 2000 is going to set a link to open in a new
window. And there is no way of knowing by looking at settings in Word (either
2000 or 2003). In the case of these four documents, I surely created all four
hyperlinks in the same way as each other. Probably it was with the icon in
the toolbar. Well, I find it somewhat annoying that Word randomly decides
whether a link is supposed to open in a new window or not. But I guess it is
what it is. Thanks again.
 
B

Bob Buckland ?:-\)

Hi Barbara,

Where are you looking at the source of these pages?
Word 200 didn't have a built in 'filtered' version of Web documents, it used an Office 2000 add-in/utility to achieve that.

If you're looking at the document in Word use Alt+F9 to toggle the field codes and edit them there. The target="_blank" portion is
valid HTML.

How a new page in a web browser opens or reuses the existing instance can depend on the browser settings of the person visiting the
web page

=============
Thanks for your answer, Robert. If I understand you correctly, it is simply
unpredictable whether Word 2000 is going to set a link to open in a new
window. And there is no way of knowing by looking at settings in Word (either
2000 or 2003). In the case of these four documents, I surely created all four
hyperlinks in the same way as each other. Probably it was with the icon in
the toolbar. Well, I find it somewhat annoying that Word randomly decides
whether a link is supposed to open in a new window or not. But I guess it is
what it is. Thanks again.
--
Barbara Hill>>
--

Bob Buckland ?:)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*
 
D

Don

Thanks for your answer, Robert. If I understand you correctly, it is
simply unpredictable whether Word 2000 is going to set a link to open
in a new window. And there is no way of knowing by looking at settings
in Word (either 2000 or 2003). In the case of these four documents, I
surely created all four hyperlinks in the same way as each other.
Probably it was with the icon in the toolbar. Well, I find it somewhat
annoying that Word randomly decides whether a link is supposed to open
in a new window or not. But I guess it is what it is. Thanks again.


Using Word to either create or view web pages is NOT a sound practice.

Have no clue how to prevent Word from inserting the new page option
randomly.
You might try unselecting "Updating Links on Save" in the Web Options.

However, it's a simply matter to use any text editor (most Win comes with
Notepap) and search and replace the following

target="_blank"

replace with delete

save and upload the revised page.

There are also many free html editors that offer string repalcement across
selected folders.
I use "Search and Replace 98", which has proven a very benefical time
saver.
 
B

Barbara

Bob,

I have been looking in the Edit Hyperlink dialog in Word, and I have been
using Notepad to look at the HTML. When I use Shift + F9 to look at the field
codes in Word, I find that all four links include the \n switch. (I have no
idea just how that switch got there.) So now the question becomes, "Why does
Word sometimes preserve and sometimes discard \n?"

You have given me a way of dealing with this in Word, at least: I can show
all the field codes and remove \n. Thanks!
 
B

Barbara

As for your comment, "Using Word to either create or view web pages in NOT a
sound practice"...

This was the best idea I could come up with. We have many content authors
contributing to our web site. They all have Word (mostly Word 2000, which is
currently the corporate standard). Very few of them have, say, Dreamweaver.
So our process is to develop, review, and approve content in Word (just
treating everything as a normal document, not a web page). (This does involve
a number of weird rules about graphics placement, table setup, avoiding tabs,
flagging links that should open new windows, etc.) Then we (the content
managers) use Word 2003 to create filtered HTML. Then we run a script that
tweaks various things in the HTML. Then we paste the HTML into IBM Websphere
WCM, which is where the web content actually resides. This process is not
pretty. But it does enable our authors and reviewers to work in an
application with which they are familiar and which gives them most of the
capabilities they need to create the content.
 
R

Robert M. Franz (RMF)

Hello Barbara
Thanks for your answer, Robert. If I understand you correctly, it is simply
unpredictable whether Word 2000 is going to set a link to open in a new
window.

hardly anything concerning software is "unpredictable." [OK, let's not
discuss Word numbering, but you know what I mean ... :)]

What I'm saying is you need to investigate different methods of
inserting a link, (and different setups in terms of version and SP of
Word), and compare the HTML code.

I very much doubt (FWIW, of course :)) that, creating a link in the
same way, and using the same installation and HTML-conversion, creates
different code.

..2cents
Robert
 

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