Can someone tell me how can I disable the browser's close button and back button. i.e user can not see the browser's close button or back button or can not click on the close button or back button of the browser. If user clicks nothing should happen or it should be completly hidden from user.
Solution can be in java or javascript or win32 apis..
We use this technique in-house for opening a browser window on top of all other apps so the user can use in-house hosted forms/webapps etc. Please remember to offer a close button.
NB: This only works for IE:
<html xmlns="http://www.w3.org/1999/xhtml">
<script for="window" event="onload">
window.open('main.jsp',
'Your Name',
'width=800,height=600,resizable=0,status=0,toolbar=0');
<!-- Stops user from being able to press BackSpace -->
window.opener = window.top;
window.open('', '_self', '');
window.close();
</script>
</html>
Related
I want to add Spring Security to my project. The way I want this to work is:
On my page, I have static header with "Login" button. When I click the button, javascript piece of code is hiding page content and shows a modal with login form. Currently, "Login" button looks like that: <li>Login</li>, so basically, it redirect me to the same page. I want to leave it that way, so I won't call a different login.html page in .formLogin("login.html"), but I will just show a modal with login form.
How to archieve that? - I guess I need to somehow redirect to the same page with modal opened, or do something like automatically perform a click on Login button
main.js
var menulogin = document.getElementById('menulogin');
menulogin.addEventListener('click', function(e) {
document.getElementById('login').style.display='block';
document.getElementById('box').style.display='none';
});```
You could potentially use .formLogin("/login") and handle the request mapping for "/login" in your controller to load the same page with modal opened.
I'm having issues with logging into specific website via HtmlUnit methods.
The site form's submit button looks like this:
<td>
<input type="button" value="Login!" onclick="encPass(UTM_STUDIO_ADMIN);" class="normalButton">
</td>
Mine code snippet:
final HtmlButtonInput submitLogin = form.getInputByValue("Login!");
HtmlPage returnPage = submitLogin.click();
System.out.println(returnPage.asText());
Yet, it prints the logging site with username and password fields fulfilled, that's all.
WebClient config:
wclient.getOptions().setPrintContentOnFailingStatusCode(false);
wclient.getOptions().setCssEnabled(false);
wclient.getOptions().setThrowExceptionOnFailingStatusCode(false);
wclient.getOptions().setThrowExceptionOnScriptError(false);
wclient.getOptions().setUseInsecureSSL(true);
wclient.getOptions().setJavaScriptEnabled(false);
I've been already trying to log via my own added button, and played with ideas of waiting, enabling JS, redirecting etc., but I'm new in the topic so it does not guarantee I can uncheck any ideas as already tried.
Your button is of type button (not submit). In this case the browser renders only a button but the application developer is responsible for doing something if the user clicks the button. In you case the button will trigger some javascript.
But you have disabled Javscript by
wclient.getOptions().setJavaScriptEnabled(false);
Maybe your problem goes away if you enable javascript.
In general it is a good idea to start with the default setting when facing any problems. The defaults are set in a way to be as close as possible to the real browsers.
I have 2 xhtml pages, one normal page with some data and button for calling modal dialog. Modal dialog includes second page with java applet ( tag). I've noticed that after I click submit button browser is freezed for a few seconds while Java is loading.
<p:dialog header="Page2" widgetVar="dlg4" modal="true" height="350" width="550" closable="true" resizable="true" draggable="false">
<ui:include src="itemSigning.xhtml" />
</p:dialog>
If I'm correct, primefaces works this way: when page 1 loads (that have some dialogs defined), every modal dialog defined in that page is loaded, right? Is there a way to tell modal dialog to load its content at the moment it is opened?
So, I when I press submit button, I would like modal dialog to be opened instantly and applet after I open dialog (and page 2 in it) so I can write some message to user like: "Wait for a moment until Java is loaded..."
I want to avoid browser window freezing for 2-3 seconds before modal dialog is opened (probably because Java is loading at that moment).
Is it possible?
Thanks
As per the Primefaces 5.1 User Guide Page 177
Tag: Dialog
Attribute: dynamic
Default: false
Type: Boolean
Description: Enables lazy loading of the content with ajax.
I have a web page in jsp extension , which is built using jsf. There are command links for some user ids, i.e. every user id is a command link. When a user id is clicked, it goes to another page, where some action can be done.
<h:commandLink value="#{user.userId}" rendered="#{bean.myName == 'ID1'}" action="#{bean.userIdHasBeenSelected}" immediate="true"/>
Now if the action returns a string called "notDone", i want to show an alert pop up in the jsp and the page will not be navigated and will remain in the same page. But , if the action returns the afore mentioned string , the page will just be not navigated..it will not be reloaded or refreshed..then how can i use window.onload here ?
If not window.onload , then is there any other way of doing it ? One point to be remembered is that, the action is evaluated at java side.
Any suggestions will be deeply appreciated.
Is it possible to run JavaApplet when you press a button , or when you click on the image on the webpage?
Maybe you guys can share any example, related html/jscript/jquery?
What is wrong with my code at this point?
<html>
<script>
function openApplet(){
var attributes = {codebase:'.',
code:'d.Applet',
archive:'Applet.jar',
WIDTH=500, HEIGHT=300} ;
}
</script>
<body>
<applet id="myapplet"
CODEBASE="."
ARCHIVE="Applet.jar"
CODE="d.Applet"
WIDTH=500 HEIGHT=300
style="visibility:hidden;"
>
</applet>
<input value="Applet_on_Click" onclick="openApplet()" type="button">
</body>
</html>
I'm just looking for very simple solution. Click on the image , applet shows up, click on the different image , another applet will show up. Or maybe these things can happen when we press a button too?
Update
Thank you slowpoison for the information!
But I'm missing something.
There is my original code now:
http://www.text-upload.com/read.php?id=360320&c=7544773
This is working just with pure html. But there is no action when you click on the button.
If I disable this row "style="visibility:hidden" , applet will show up without a click.
I wan't to show applet just after the button click. :(
You should add the applet tag to the document in the onclick handler.
var applet = document.createElement("applet");
// fill in various attributes for applet
// ...
// "install" the applet
document.getElementById("appletContainer").appendChild(applet);