I want to open a page in a new window/tab but when it's oppen the page don't load.
Controller:
public static Result loadCreateArtigo(){
return ok(request().host()+request().path());
}
JavaScript:
$.SmartMessageBox({
buttons : '[Não][Sim]'
},
function(ButtonPressed) {
if (ButtonPressed === "Sim") {
Controller.loadCreateArtigo().ajax({
success: function(data){
window.open(data);
},
});
});
The var 'data' returns the url. The url is right but the page don't load. Just load if I click F5. I'm using Google Chrome. Some suggestion?
EDIT:
I'm testing some possible solutions and i got it: if I put window.open("www.google.com"), the new window opens with url like: localhost:9000/"mypath"/www.google.com. I don't know if it could help but...
I think that if you use a string url as parameter of window.open, it has to be an absolute url, like http://example.com. So be sure that your data is absolute url, else add "http[s]://" before it. For reference the MDN documentation about window.open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With