简体   繁体   中英

How to insert values into form fields on external page after it is opened from a link/button?

I am trying to find a way to do the following: From my admin site (internal), click a link from an account (that contains the username/password) and have it open a new site (external) that requires a login. Then automatically set the values of the username/password fields to the ones I pass from the admin site.

My admin site is PHP, the external site is ASPX, and I have knowledge in JQuery/AJAX, so any of those methods will work.

Thanks!

Here is what I have tried so far with jquery Code:

$('#login').click(function(){
var newpage = window.open("URL",'blank');
newpage.myForm.elements["username"].value = 'Testing';
});

*Update - Can not edit the external page to use GET. Need to find a way to directly paste the username/password into the form fields on the external from the internal one.

即使加载到iFrame中,也无法更改外部站点的字段,而无需调整浏览器安全设置(访问该站点的所有人都不可以使用此功能)。

You can pass the username and password as a query string and on the aspx page just get the values from the query string and populate the fields.

it is not a good idea to pass the username and password info from one site to another.

you can create the link like this

$passwd = md5("password");
<a href='http://example.com/login.aspx?username="testing"&password="<?php echo $passwd ?>' target="_blank" id="login">

once you open the page on the aspx just get the username and password values from the url and populate the fields. do a reverse md5 of password before populating

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM