Open page in new window, but add some text

A

Anna

Hi all.
I have a (hopefully) pretty simple question.
I open a link in a new window:

<a href="http://www.somewhere.com/some.hml"
onclick="window.open(url,null,'resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width=600,height=400');">Link</a>
The page I am opening is not mine.
I want to edit the content of the page I am opening, adding text
"This page is opened in a new window" as a first thing after the body
tag of the opened page.

Is it possible to do it with javascript, while opening the page, or
should I use Java?

Thank you very much for help.

Anna
 
E

Evertjan.

Anna wrote on 15 jul 2003 in comp.lang.javascript:
I open a link in a new window:

<a href="http://www.somewhere.com/some.hml"
onclick="window.open(url,null,'resizable=yes,toolbar=no,location=no,dir
ectories=no,status=no,menubar=no,scrollbars=yes,width=600,height=400');
">Link</a> The page I am opening is not mine.
I want to edit the content of the page I am opening, adding text
"This page is opened in a new window" as a first thing after the body
tag of the opened page.

Is it possible to do it with javascript, while opening the page, or
should I use Java?

It is not your page, so security forbids you to alter it.

You could data-mine the page serverside and
use the parts to make a new page, however.

I do not know where your Java should come in though.
 
A

Anna Afonchenko

Thanks for answering.

I don't really want to change the actual page.
What I was thinking, is maybe copy all the contents of the page, edit
it, and present the edited content in a new browser window. That way I
will not need to edit the page serverside. But this cannot probably be
done with javascript, I am using now JSP+Java.
I just thought, that maybe some possibility o fthis could exist in
javascript - would be much simpler.

Thanks for help anyway

Anna
 
G

Grant Wagner

Anna said:
Thanks for answering.

I don't really want to change the actual page.
What I was thinking, is maybe copy all the contents of the page, edit
it, and present the edited content in a new browser window. That way I
will not need to edit the page serverside. But this cannot probably be
done with javascript, I am using now JSP+Java.
I just thought, that maybe some possibility o fthis could exist in
javascript - would be much simpler.

Thanks for help anyway

Anna

Client-side JavaScript in the default security environment can only read
content from the same domain it was downloaded from. That is, the XML HTTP
Request object and all the iframe "tricks" to read/parse HTML pages only
work if you want data from a page on your own site.

For retrieving data from another host, the best solution is server-side,
where you control the technology and can guarantee the user will see what
you intended them to see.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 
D

DU

DU said:
<a href="http://www.somewhere.com/some.html" target="RequestedPopup"
onclick="window.open(this.href, this.target,
'resizable=yes,status=yes,scrollbars=yes,width=600,height=400');"
title="Clicking this link will open a new window (popup) or will re-use
an already opened one">Link <img
src="http://www.brinkster.com/doctorunclear/GRAPHICS/PNG/OpenRequestedPopup.png"
class="RequestedPopup" title="Clicking the link will create a new window
(popup) or will re-use an already opened one" alt="Clicking the link
will create a new window (popup) or will re-use an already opened one"></a>

The Top Ten New Mistakes of Web Design
3. Non-Standard Use of GUI Widgets
"Interaction consistency is an additional reason it's wrong to open new
browser windows: the standard result of clicking a link is that the
destination page replaces the origination page in the same browser
window. Anything else is a violation of the users' expectations and
makes them feel insecure in their mastery of the Web."
http://www.useit.com/alertbox/990530.html
J. Nielsen

but he offers a way to compensate this "consistency violation" accordingly

Ten Good Deeds in Web Design
"8. Use link titles to provide users with a preview of where each link
will take them, before they have clicked on it."
http://www.useit.com/alertbox/991003.html

DU
 
D

DU

DU wrote:

I forgot the importantissimo return false in both my posts. Sorry.
<a href="http://www.somewhere.com/some.html" target="RequestedPopup"
onclick="window.open(this.href, this.target,
'resizable=yes,status=yes,scrollbars=yes,width=600,height=400');

return false;

"
title="Clicking this link will open a new window (popup) or will re-use
an already opened one">Link <img
src="http://www.brinkster.com/doctorunclear/GRAPHICS/PNG/OpenRequestedPopup.png"
class="RequestedPopup" title="Clicking the link will create a new window
(popup) or will re-use an already opened one" alt="Clicking the link
will create a new window (popup) or will re-use an already opened one"></a>

and while I'm at it, your "link" text is certainly not recommendable. J.
Nielsen again on this:

7. Begin Link Names with the Most Important Keyword
"Links are the action items on a homepage, and when you start each link
with a relevant word, you make it easier for scanning eyes to
differentiate it from other links on the page."
http://www.useit.com/alertbox/20020512.html

So, "link", "click me", "click here", "ok", "go", "image", etc.. are all
not recommendable ways of editing a link. But "My garden", "My dog", "My
resume", etc.. are all good ways of editing links.

DU
 
D

DU

Evertjan. said:
Anna wrote on 15 jul 2003 in comp.lang.javascript:



It is not your page, so security forbids you to alter it.

You could data-mine the page serverside and
use the parts to make a new page, however.

I do not know where your Java should come in though.

I'm sure Anna misworded and mis-presented her issue, question. I'm
convinced the question, interest she meant to ask is excellent though.

Here's a page where I modify a popup window's content with only DOM
methods on a resource which is not on my domain name server (see the
Olivia Newton-John link):

Create a sub-window and dynamically DOM-insert an image:
http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/DynamicInsertionDOMImageInPopup.html

DU
 
D

DU

DU said:
The Top Ten New Mistakes of Web Design
3. Non-Standard Use of GUI Widgets
"Interaction consistency is an additional reason it's wrong to open new
browser windows: the standard result of clicking a link is that the
destination page replaces the origination page in the same browser
window. Anything else is a violation of the users' expectations and
makes them feel insecure in their mastery of the Web."
http://www.useit.com/alertbox/990530.html
J. Nielsen

but he offers a way to compensate this "consistency violation" accordingly

Ten Good Deeds in Web Design
"8. Use link titles to provide users with a preview of where each link
will take them, before they have clicked on it."
http://www.useit.com/alertbox/991003.html

"Until user agents allow users to turn off spawned windows, do not cause
pop-ups or other windows to appear and do not change the current window
*_without informing the user_*.
(...)if your link spawns a new window, or causes another windows to "pop
up" on your display, or move the focus of the system to a new FRAME or
Window, then the nice thing to do is to tell the user that something
like that will happen."
W3C Web Accessibility Initiative Checkpoint 10.1
http://www.w3.org/WAI/wcag-curric/sam77-0.htm


DU
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top