I have a requirement to open a new window(URL is dynamic) when I click on a button.
function openWindow(){
window.open('//www.google.com/','_blank');
}
Here my problem is , JavaScript is opening new window but Appliation name is also appending to URL. i.e it is opening new window with the below URL
http://localhost:8090/www.google.com/
I have tried all the combinations in URL but it is not working
Please do needful
BalusC
1.1m377 gold badges3.7k silver badges3.6k bronze badges
3 Answers 3
update your javascript function like
function openWindow(){
window.open('http://www.google.com/','_blank');
}
answered Feb 9, 2016 at 7:35
Shailesh Singh
4212 silver badges8 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Shailesh Singh
@Raj create a online demo which you try to implement
Use action listener to open new window in icefaces
<ice:commandLink value="click me" actionListener="#{bean.myActionListener}"/>
------------------------------
public void myActionListener(ActionEvent event) {
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "window.open('report.iface', 'myWindow');");
}
------------------------------
answered Feb 9, 2016 at 7:51
Bhuwan Prasad Upadhyay
3,1262 gold badges31 silver badges34 bronze badges
2 Comments
Raj
hi developerbhuwan, I tried this code before writing java script. it is also not working , thats the reason I moved to java script .
Raj
and I tried below code also.. it is not working too JavaScriptRunner.runScript(FacesContext.getCurrentInstance(), "window.open('google.com' , '_newtab');");
Use window.open("http://www.google.com");, tested works in all browsers.
Comments
lang-js
http://www.google.com- which will probably redirect tohttps- but it works fine in firefox anyway