Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 450 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
page loads twice in Google chrome

#1
Does anyone have any problems with Page_Load being executed twice in Google Chrome?
It's a short question, i do not know what else to explain...

I have a simple asp.net page and in Firefox and IE all it's working fine.
But in Chrome the Page_Load is fired twice...

Anyone has any ideas why?

Later EDIT:
- what is strange is that i have 4 repeaters... binded with random values. The random methods are twice fired (because of page loaded twice) but the repeaters takes the INITIALLY values...so, the 2nd post back is somehow raised after the rendering step.

3rd edit: It happens ONLY at the refresh!

**Solution (in my case):** There was an empty img src, and that was the cause

Reply

#2
So far I've used Chrome to test ASP.NET pages many times and never encountered this. What are you doing client-side that could cause this? Are you doing any AJAX stuff?
Reply

#3
I noticed that this started happening to me when I switched to Chrome v.4, the developer's channel, so that i could start using extensions. Didn't seem to be a problem with v.3, the stable version.
Reply

#4
In your Page_Load, check the value of Page.IsPostBack and Page.IsCallback to see if they differ between the two calls. If they're different, it could be some javascript reexecuting or chrome following a redirect twice or something odd like that.
Reply

#5
I notice this same issue in IE if the page contains img tags that don't have a src attribute (or the src is empty, etc). Not sure if Chrome does the same thing, but worth checking, right?
Reply

#6
I encountered a similar problem with PHP and Firefox.

The problem was coming from a faulty style definition that Firefox interpreted to reload the page.
I cannot remember exactly what it was but int the idea, could be something like

.my_class { background: url(#); }

I would advice to try to isolate first your CSS and then your HTML sections to check if the problem might come from it.
Reply

#7
I believe it is just how Google Chrome works. I put some code on my index page to write to a file with the file name that was loaded, and every time I load the page (using refresh or a new window) it puts 2 results in the file.

EDIT: I renamed my index file to test.php and ran it again. This time it only had one result. This problem is pissing me off.

EDIT: I renamed my file back to index.php and ran it. Same problem. Then I renamed my .htaccess (for mod_rewrite) to htaccess so it wouldn't be parsed and the problem is gone. After I found this out, I disabled url rewriting in the .htaccess file and the problem was still gone (finally). I did one more test (if people are still reading this crap) and found that google loads the page twice when you redirect from the .htaccess file. I found a little workaround that seems to fix the problem.

Not sure if this applies to asp.net. I only know php coding and apache servers.
Reply

#8
If you set your image tag src to # or empty it will cause twice pageload calling, i faced this on chrome and before on firefox.

you can put any char or string value instead of empty or # to solve this issue.
Reply

#9
It also doesnt like empty href's

I had an empty favicon link tag and it did the same thing. Whoever said about the empty src put me onto that, just stripped out everything until it started working
Reply

#10
Gecko based browsers apparently do this when the markup is incorrect. That means XHTML AND CSS.

Here is a great post about the issue:

[To see links please register here]


That's why some of you guys are getting the problem when you have a blank src attribute or a blank href attribute. Incorrect syntax, the browser reads it as an "error". I guess it's a more unobtrusive type of error that you would otherwise not even notice, but due to the nature of the page you're working on it's become apparent and presented itself as a rather obtrusive problem.

What certain browsers consider to be an 'error' and what is 'passable' is probably slightly different too, that would explain why some of you are having the problem in FF and not in Chrome and visa versa.

Just be thankful you're not in my shoes. I've got a page that's sending an email out twice due to this issue and there's no way I can fix the bad markup because there's just simply too much of it to fix being generated in far too many places, a lot of the CSS and HTML issues are dynamically driven too unfortunately.

I still don't understand the reasoning behind it grabbing the page twice though when it encounters non-compliant issues of this nature though.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through