Skip to content Skip to sidebar Skip to footer

How To Open A New Window In The Same Page

I have a button: I want click it and open a new window in the same page, I bind the click event an event handle: $('button').click(function () {

Solution 1:

Well that's not possible technically, it also depends on browser tab settings, window settings and third party tab manipulation plugins or addons.


Update

OP has cleared the confusion of all through his comment below his question, this is what you need to set a new url for current window:

$('button').click(function () {
    var newurl="http://" + window.location["host"];
    window.location.href = newurl; // or simply window.location
})

Solution 2:

window.location =newurl; will open a new window replacing the parent

Solution 3:

Have you tried this?

<scripttype="text/javascript">window.open ('test.htm','_self',false)
</script>

Solution 4:

If you mean you want to replace the current page, window.location = newLocation; will do. If you want a modal popup, try JQuery UI Dialog.

Post a Comment for "How To Open A New Window In The Same Page"