javascript - Weird behavior in Google chrome (After submitting a form, it goes to the bottom of the page) -


I have a template design, everything works fine when I submit a form when the server responds (the same page ), Then they will go to the bottom of the page. This happens if the whole page is larger than the height of the screen. Example (if whole page is smaller than screen height):

  • Submit form, server responds with one page
  • Example (if whole page is larger than screen height ):
    • Submit the form, the server responds with the same page, then the page goes down.

I disabled javascript ( & lt; script & gt; tag has been deleted). And it only happens in Chrome

I have tested it in Firefox and IE, and after submitting the form the page will be on top.

..........

Also, if I have an empty & lt; Script & gt; Before content & lt; / Script & gt; tag, just like that. Page (in Chrome) I'm assuming how it should be how Chrome presents the page

If any & lt; Script & gt; tag, Chrome will render the page aggressively. And if there is a & lt; Script & gt; tag, it will be presented in a slower or different way.

..........

Also, I am using Symfony2 (a PHP structure), every time that dev mode when I switch to prod mode (CSS and JS are compiled and mixed), it rarely happens.

I usually say that the problem is CSS / HTML layout but only this happens in Chrome and if the page is served in a timely manner (faster), the problem disappears ( The page stays on top).

My question is : Is this known issue? Can it be relatively easy to determine? Or should I just pray that the page is fast enough so that there is no problem?

Chrome version: 38.0.2125.111 (64-bit)

If you need more details, then I will be happy to provide them thanks in advance

Edit: The server responds to both dev and prod mode of the same page. The difference is that in prod mode, it is optimized for production environment

If anybody is in any position, then CSS / JS is merged and compiled. It is my experience, it is my solution:

Be sure to cIn minus / uglyfe, complex / merge CIS. Use aggressive cache so Chrome does not present the page without the necessary CSS style.

& lt; Script & gt; & Lt; / Script & gt; There is a hack somewhere in the content

I would recommend using jquery:

  $ ('html, body'). Chetan ({scrollTop: 0}, 'slow');  

The problem will only be if after submitting the form, you do not redirect (the form has errors) if the form errors are, then you will probably display message warning warning, so that script Together you will scroll / animate that div element.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -