How to disable browser close button - javascript

is there way to disable browsers close button and it will open after voting my polls. like firefox using JavaScript or jquery? i created an auto open browser using C# for every 10am it will open my intranet web page and i want all viewers to vote my polls before leaving my page..

No. It is absolutely impossible for a webpage to prevent users from closing or otherwise leaving it.
The unscrupulous would love to be able to display an unclosable window of rotating adverts to everyone who visited their website.

Related

Is there any way I can open new tabs on Chrome without javascript?

I am creating a website and on the website, I need about 10-20 more tabs on the user device,
I know how to do this with javascript but the user can disable javascript on the browser which basically stops the entire point of the website, is there any way to do it without javascript (maybe sending a header to Chrome or something that opens a website in a tab)?
There is no way to do that without JavaScript to open multiple tabs at once.
You can make a link open a new tab with the target attribute when clicked by the user, but that is limited to one new tab for one user interaction.
maybe sending a header to Chrome or something that opens a website in a tab
Even if that would be possible with some kind of trick, it would likely be fixed in an update in the browsers, because this will this would be definitely be abused by dubious websites.
Well, the pure HTML way to do that is through the target attribute of any hyperlinked element (A, FRAME, FORM), which shall contain the name of the window that should receive the content of the hyperjump.
Example:
<!--These two hyperlinks redirect the URLs to the same tab-->
local clients
inernational clients
<!--This hyperlink redirect the URL to its own tab-->
providers
Anyway, I warn you not to abuse of this form of forced navigation, because it can chase your user out of your website: The user should be left as free as possible to chose to open or not new tabs/windows. And 10-20 tabs seems to me an overwhelming amount of tabs.

Can you make an html link that does not let you click back to previous page, or show the previous link in your history?

I am working on a client site where the client has requested that there be a button (basic a link) that links to another page like google, in case an abusive significant other busts into the room while a woman is reading about how to get assistance. The tricky part is that I am trying to figure out to link to a page that will open int he same windows, but no let you go back to the site by clicking the browser's back button, or show up in "history". I have built a lot of website and never heard of this being possible without the use of a custom browser extension or something.
My question is ..
Is there a way to do this? Possible some JS magic? Just wondering
You're looking for location.replace().
<button onclick='location.replace("https://www.google.com");'>Click to close</button>
Instead of creating a new entry in browser history, it replaces the current one.
Note: Unfortunately, it's blocked by [SO]. But just try it in your app. It does work.
Second note: If you combine this with initially opening the to be hidden page in a new tab (target="_blank") => no history.
However, the best method and advice for such cases is browsing in incognito: Ctrl+Shift+N. Once closed, it's gone, with all history in the session. Pressing Ctrl+Shift+T in a new browser window won't bring the formerly opened tabs back.
IMHO, this technique should be clearly detailed in the "Precautions" section of your client's website, also advising on having another "normal" browsing session opened in a background browser window, with a few neutral tabs open on subjects that wouldn't raise any suspicions: cooking recipes, things for children, cosmetics, etc...
I am not sure about your question.
But on click you can open Iframe
<iframe src="www.google.com" style="border:none;"></iframe>

Is it possible to focus a webpage programatically using javascript?

I have a javascript extension on top of Gmail.
Say a user navigates to some other website xyz.com.
And If there is a very important update from my extension
I want to automatically navigate the user back to the Gmail form my javascript code.
Is this possible? I have tried window.focus() but it does not seem to work.
Any other suggestions please. Thanks.

how we can restrict user to click or go on the browser window until they close the opened pop up window?

I am making a web application which takes the exam related programming languages, and i am opening a pop up window for test when a user click to start a test ,
but i want to restrict them to go on the main broweser window until they submit the exam(pope up window closed automatically) or they will close manualy
As far as i know its not possible with javascript. but cant you better use a box that will lay on top of the original page content like you can do with Jquery.
http://jqueryui.com/dialog/#modal-form
Removing the buttons and other forms of cancelation and only leave a post button when all answers are given.

how can I prevent the user leaving the page when hitting the browser back button in Jquery Mobile?

Just wondering.
I have a page in Jquery Mobile which uses a popup that opens as a fullscreen page on smartphone displays:
Desktop/Tablet:
Smartphone:
Problem is, if the user views the page on smartphone, this looks like a real page. When the user hits the "back" button I provide, I'm just closing the popover. However, if the user hits the browser back button, he's leaving the page, because he never went a page down in the history.
Question:
Since I can't disable the browser back button, is there another way to create a browser history entry when the popover opens, so when the user presses the back button, I'm simply closing the popover and the browser history is back on the initial page vs. going "-1". If there are other workarounds to achieve this I'd also appreciate any suggestions.
Thanks!
Maybe what you can do is add the popover as a dialog page if the webpage is opened from a smartphone (you can use user-agent to check for this). You might want to check http://jquerymobile.com/test/docs/pages/page-dialogs.html That way it will be added to the browser history.
Try adding a live Vclick.
or
you could try disabling the class ui,
Example:
class="ui-disabled"

Categories

Resources