www.webdeveloper.com
Results 1 to 5 of 5

Thread: Different Behavior Depending on Page's Host

Hybrid View

  1. #1
    Join Date
    May 2011
    Posts
    8

    Different Behavior Depending on Page's Host

    I have Firefox26/Firebug1.12.6. I have two browser windows open.

    In one window I am pulling a page from 127.0.0.1 ('localhost'). The other window, the page is from an intranet site, dev1.example.com. The page code delivered to each browser window is exactly the same and uses jQuery1.7.2.

    Each page functions exactly the same except for one specific action.

    The browser showing the localhost page will not execute the jQuery .submit() statement below. The browser showing the intranet page does.

    Code:
        $('img.autosubmit').each(function(){
          console.log('Auto-submitting '+'this:'+$(this).attr('src')+' '+'parent-form:'+$(this).parents('form').attr('id'));
          $(this).parents('form').submit();
        });
    I see the log entry in Firebug.

    Would there be a javascript reason (including any determinations made by the javascript engine in Firefox) why a page from a localhost would not behave the same as from a domain URL?

  2. #2
    Join Date
    Mar 2009
    Posts
    468
    I would first check out the code on the two servers that is supposed to handle the submission. Is it the same? And then there is the possibility that even if it is there is a difference in the two server configurations that may be causing the problem. So far as I know there shouldn't be a problem with the javascript behaving any differently if both of the same pages are fetched from servers rather than being read from a file on the hard drive.

    I may be wrong but I don't think so.

  3. #3
    Join Date
    May 2011
    Posts
    8
    "I would first check out the code on the two servers that is supposed to handle the submission."

    The page from 127.0.0.1 isn't submitting. That's the issue. Handling the submission isn't even in the picture as of yet.

    "There is the possibility that ... there is a difference in the two server configurations that may be causing the problem."

    Let's explore that. After the servers have each done their job and delivered the exact same code to the client, what could possibly be in a server's configuration file that would affect how a client behaves?

    "So far as I know there shouldn't be a problem with the javascript behaving any differently."

    Which is why I made the post. I'm hoping for a clue with respect to the client's point of view.

  4. #4
    Join Date
    Mar 2009
    Posts
    468
    Assuming that all things are equal: browser/browser version/OS/protocol it should make no difference as to the behavior that will be given to the same page and resources. That is most likely the source of your problems--its not really getting exactly the same page or exactly the same resources.

    And yes, server configuration can matter. The headers sent to the browser can affect the loading. If ETags are not handled properly by the server for example it may well be that a resource such as a javascript file that needs to be updated won't be, and the old cached version will be used instead.

  5. #5
    Join Date
    May 2011
    Posts
    8
    "Assuming that all things are equal..."

    All things are equal. I am not assuming. Each browser window is really getting exactly the same page and exactly the same resources.

    (Well, in the few seconds it took between "document ready" in browser window #1 and "document ready" in window #2, Earth had moved a few hundred miles across the universe. Thus, the entire nature of reality could have shifted ever so slightly. But I doubt that would be the cause.)

    "If ETags are not handled properly by the server for example it may well be that a resource such as a javascript file that needs to be updated won't be, and the old cached version will be used instead."

    Interesting. I can see how that would happen. And if, in my troubleshooting efforts, determine that the javascript code received by each browser window is shown to be identical, where does that leave us? If, in my troubleshooting efforts, I switch off Firefox's cache (suspecting a cache issue regardless of the fact I have made absolutely no changes to the code between the intranet server and the local server), where does that leave us?

    Can we then say that a browser could:
    * display the javascript code it just received from the server, but choose to execute whatever may be in it's cache, if the page comes from 127.0.0.1
    versus:
    * display the javascript code it just received from the server, and execute that very same code, if the page comes from a domain.

    Then I would say we have found the culprit -- a difference in the operation of the browser depending on the page's host. Such a difference in operation would be by the browser - not the server.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles