473,378 Members | 1,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Open page in new window, but add some text

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,toolb ar=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
Jul 20 '05 #1
7 7007
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,toolb ar=no,location=no,dir
ectories=no,status=no,menubar=no,scrollbars=yes,wi dth=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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Anna Afonchenko wrote:
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 <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_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-deve...upgrade_2.html
Jul 20 '05 #4
DU
DU wrote:
Anna wrote:
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,toolb ar=no,location=no,directories=no,status=no,menubar =no,scrollbars=yes,width=600,height=400');">Link</a>

<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
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #5
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
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #6
DU
Evertjan. wrote:
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,too lbar=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.


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/doctorunc...geInPopup.html

DU
---------------------------
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #7
DU
DU wrote:

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
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
2
by: Richard Bell | last post by:
Newbie question ... please respond to group I'm trying to open/navigate to a url. How can I tell when the page is fully loaded? Testing suggest that window.open returns before the page is...
3
by: ACaunter | last post by:
Hi all, I need to set a session variable and open a new window with a single click of an asp.net button. My problem is that it always takes two clicks.. one sets the session and the other opens...
5
by: Chris | last post by:
Hello, I have a link on an aspx page. The URL is set in the Page Load event: lnkEventHistory.NavigateUrl = "javascript:window.open('EventHistory.aspx?TeenID=" & _ Request.Item("SubjectID") &...
1
by: Angelos | last post by:
Hello there, I am very new to Javascript and before I explain what I want I'll tell you in a few words that I am trying to make a button on a WYSIWYG text editor (RichArea) that previews on a...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
5
by: rockdale | last post by:
Hi, all: I have a linkbutton and I use javascript to open another webpage in a new window. I also want to set my session variable value when this linkbutton get clicked. These session variable...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
6
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the...
3
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.