locked
how to disable the reload option in browser? RRS feed

  • Question

  • User-1234271576 posted

    hi,i have disable the f5 option and mouse right click reload option in an asp.net web project using javascript.but i didn't get to disable the reload button in browser,how it is possible,can any one please help me?if it is not possible to reload,i want to display some.aspx page,or something error message  when i click on reload button,please help me.....

    Wednesday, September 11, 2013 8:03 AM

Answers

  • User551462331 posted

    does this work?

    function basicPopup(url) {
    
    popupWindow = window.open(url, 'popUpWindow',
    'height=500,width=500,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=yes');
    window.close();
    }

    also, note that in new window u may not see the refresh button... but, user can press ctrl+F5 to refresh the page

    hope this helps...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 16, 2013 3:45 AM

All replies

  • User-821857111 posted

    It's not possible to disable it. It belongs to the browser. There is no way to determine if a request for a page is a result of someone clicking the reload button or through any other means. 

    By the way, have you disabled Ctrl + R? That refreshes the page in most browsers. And what about user's custom keyboard shortcuts that some browsers allow? Ho do you plan to manage those?

    I suggest that whatever problem you are trying to solve, you are going the wrong way about it. Perhaps if you explained why you want to try to hobble browsers, someone can suggest a better solution.

    Wednesday, September 11, 2013 8:24 AM
  • User551462331 posted

    hi,i have disable the f5 option and mouse right click reload option in an asp.net web project using javascript.but i didn't get to disable the reload button in browser,how it is possible,can any one please help me?

    not possible... as a user, would u like if u go to www.somesite.com , click on refresh and it wont allow u to refresh the page? of course not... it should be users choice

    ,i want to display some.aspx page,or something error message  when i click on reload button,please help me.....

    page refresh will invoke the same url again... !IsPostBack ... so it will be served as if user has requested the new page

    what exactly u r trying to achieve? we could suggest some alternate way based on requirement

    Wednesday, September 11, 2013 8:32 AM
  • User-1234271576 posted

    i did like this.......

    when i select the option form dropdown list,and click submit,the next page will open in new window,like this,,,,,,,,,,,,,

    function basicPopup(url) {

    popupWindow = window.open(url, 'popUpWindow',
    'height=500,width=500,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=yes');
    window.onfocus = function () { window.close(); }
    }

    in code........(for submit button click)

    protected void Button1_Click(object sender, EventArgs e)
    {
    con.Open();
    Session["Domain"] = DropDownList1.SelectedValue;
    if (DropDownList1.SelectedItem.Text == ".NET")
    {
    ClientScript.RegisterStartupScript(this.GetType(), "alert", "javascript:basicPopup('ToStartTest1.aspx');", true);

    }
    else if (DropDownList1.SelectedItem.Text == "JAVA")
    {
    ClientScript.RegisterStartupScript(this.GetType(), "alert", "javascript:basicPopup('JavaPaper.aspx');", true);

    }

    else
    {
    ClientScript.RegisterStartupScript(this.GetType(), "alert", "javascript:basicPopup('OraclePaper.aspx');", true);

    }

    }

    here my problem is,when i select the item form ddl,click submit it will open new window with no reload,option,but it dosen't close the back page,how to close the back page,can any one please help me..........

    Monday, September 16, 2013 2:10 AM
  • User551462331 posted

    does this work?

    function basicPopup(url) {
    
    popupWindow = window.open(url, 'popUpWindow',
    'height=500,width=500,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=yes');
    window.close();
    }

    also, note that in new window u may not see the refresh button... but, user can press ctrl+F5 to refresh the page

    hope this helps...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 16, 2013 3:45 AM