开发者

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

开发者 https://www.devze.com 2023-03-25 01:38 出处:网络
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

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.

开发者_JS百科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.


Not possible to alter fields for external site, even if loaded into an iFrame, without adjusting browser security settings (not feasible for everyone who accesses the site to use this feature).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号