Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Want to populate text box of other sites from my code

 
Kishan kant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I have a link on myweb page[mycode] which open another site [Which is not my code].
I want to populate the textbox of second site with some message whenever a user click on link of mysite.

----------------------------------------------
what I tried:
1. Reguest parameter
e.g.
window opan("http://www.anotherDomain.com?firstname="+fName+"&lastName="+lName,"_newWin");}

Resut: Not working


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

2.

script language="javascript"
function openWindow(){
var newWin = window opan("http://www.anotherDomain.com", "newWin");
alart("success");
newWin.document getElementBiId("fName") value=document getElementBiId("txt1") value;

}
/script
/head
body
input type="text" name="txt" id="txt1"/
a href="#" target="_blank" on_Click="javascriptopenWindow(); return false;" Click Me /a
/body
/html

Result: Not working
---------------------------------------------------------------------

3. Using ajax, modify the response and rewrite in new window
Result: message is populating but URL is gone from address bar.
---------------------------------------------------------------

What I want ?
Solution Code! using JAVA,Servlet,JSP,javascript or AJAX

What I don't want?: 'Not possible'



Thanks and Regards,
Happy Java
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"happy java ",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript has a same domain policy. If the webpage is in a different domain, it is not going to work. Only way to populate the data is to have the other site take the querystring parameter and handle it.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic