Si8
Si8

Reputation: 9235

Allow user to change URL in window.open()

I have the following code which opens a new window when a user clicks on a button:

$('.loginButton').click(function () {
    var strString = $("#medlineSearch").val()
    var strSearch = "http://google.com&query=";
    var url = strSearch + strString;
    alert(strSearch+strString);
    var windowName = $(this).attr('id');
    window.open(url, windowName, "height=750,width=1250,scrollbars=1,resizable=1,location=1");
    // custom handling here
    return false;
});

What I am looking to do is allow the user to enter something else in the address bar which seems to be read only.

Is there any way to change that?

Upvotes: 3

Views: 6525

Answers (2)

Patrick Hofman
Patrick Hofman

Reputation: 157136

If you want to be able to change it, set the target to _blank.

This will prevent the new page to open as popup, but as new page.

window.open
( 'http://google.com'
, '_blank'
);

The jsfiddle.

Upvotes: 2

You cannot change the url in popup window.


Read change url of already opened popup
Trick to do so

open console and type location.href='http://link.com'

Upvotes: 3

Related Questions