1
window.open(url,"_blank_");

I have a sensitive parameter in the url (a password), is it possible to change the shown url on the addressbar in the opened window/tab?

Marcel Korpel
  • 21,536
  • 6
  • 60
  • 80
nagy.zsolt.hun
  • 6,292
  • 12
  • 56
  • 95

2 Answers2

4
<form method="POST" action="url" target="_blank">
    <input type="password" name="password" />
</form>

EDIT:

Same, done with javascript:

function navigate(url, data, method){
    var form = document.createElement('form');
    form.setAttribute('method', method);
    form.setAttribute('action', url);

    for(var name in data){
        var hidden = document.createElement('input');
        hidden.setAttribute('type', 'hidden');
        hidden.setAttribute('name', name);
        hidden.setAttribute('value', data[name]);
        form.appendChild(hidden);
    }
    document.body.appendChild(form); // Does not need this line in chrome
    form.submit();
}

Usage:

navigate('url', { password: 'mypassword' }, 'POST');
karaxuna
  • 26,752
  • 13
  • 82
  • 117
  • Also, use HTTPS to post sensitive data; with plain HTTP a password can be easily sniffed. – Marcel Korpel Mar 07 '13 at 13:10
  • I am not sure I understand this syntax. The service I am reaching with the URL is not implemented by me. This what i am trying to reach: https://confluence.atlassian.com/display/JIRA/Using+the+Issue+Navigator (Accessing protected data) – nagy.zsolt.hun Mar 11 '13 at 07:43
  • The form has to be appended to document.body: http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit Once you update your answer i accept it. – nagy.zsolt.hun Mar 11 '13 at 13:42
  • @user1977315 it works without appending form to body, I tested it (In chrome only) – karaxuna Mar 11 '13 at 13:50
  • @nagy.zsolt.hun ok, updating – karaxuna Mar 11 '13 at 13:56
0

Use this syntax

window.open(URL,name,specs,replace)

refer this document for more information http://www.w3schools.com/jsref/met_win_open.asp

Anand saga
  • 1,433
  • 11
  • 23