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 | | | | re: Open page in new window, but add some text
Anna wrote on 15 jul 2003 in comp.lang.javascript:[color=blue]
> 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?[/color]
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) | | | | re: Open page in new window, but add some text
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! | | | | re: Open page in new window, but add some text
Anna Afonchenko wrote:
[color=blue]
> 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[/color]
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 <gwagner@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 | | | | re: Open page in new window, but add some text
DU wrote:
[color=blue]
> Anna wrote:
>[color=green]
>> 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>
>>[/color]
>
>
> <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>
>[/color]
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/ | | | | re: Open page in new window, but add some text
DU wrote:
I forgot the importantissimo return false in both my posts. Sorry.
[color=blue]
>
> <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');[/color]
return false;
"[color=blue]
> 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>
>[/color]
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/ | | | | re: Open page in new window, but add some text
Evertjan. wrote:
[color=blue]
> Anna wrote on 15 jul 2003 in comp.lang.javascript :
>[color=green]
>>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?[/color]
>
>
> 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.
>[/color]
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/ | | | | re: Open page in new window, but add some text
DU wrote:
[color=blue]
>
> 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
>[/color]
"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/ |  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|