Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Safari and query strings (Beware the Location header!)

    I am having some funkiness.

    I have a ColdFusion function that returns the name of the current master template and the query string if one is present, all for the purpose of easily supplying a self-reference to forms regardless of their environment.

    Well, Safari seems to be appending stuff I didn't ask it to append to my query strings.

    Say I have a form with this action:

    admin.cfm?action=software&option=update&software=8

    When I submit the form, it posts back to itself but with the 'action' param value appended with the question mark at the end.

    admin.cfm?action=software&option=update&software=8?action=software

    So then, another function expecting a numeric value from #url.software# (url is how to reference the 'GET' scope in CF) chokes and dies when it receives '8?action=software' instead of '8'

    Is there some fundamental behavior of Safari that I should be aware of? This does not happen in other browsers. It's not a coding issue. I check the action of the form before I post it, and the source is correct.
    Last edited by ]|V|[agnus; 08-11-2005 at 11:24 PM. Reason: Solved issue: make full scope of thread clearer

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is a most bizarre bug. I thought for a moment that maybe, somehow, some scripting was conflicting with this, that or the other thing and causing the bug, but upon disabling all scripts I still get the bug.

    What's weird is Safari is not doing this to all sites with forms posting to actions with query strings. Nonetheless, it and it alone is being affected by this strange bug.

    Best I can think at this point is to do some string replacement at page load to make sure query strings don't have extra "?" or name/value pairs.

    So weird, though...

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Figured it out...

    After the form posts back to the page, some code is run to make the database update. After this I send a location header to redirect the browser to the listing of all items that can be updated. The value I was passing it was simply a query string. It appears that there is then a difference in how Safari handles that header information compared to other browsers. Safari apparently demands a reference to a document in addition to a query string, otherwise it just appends the location value to the current document+query_string, rather than simply appending the location value to the current document, replacing the old query string. As I said, Mozilla, IE and Opera all handle location headers with just a query string with no problems.

    Phew!

  • #4
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Crisis averted
    Thanks for posting the solution too

    I take no responsibility for the above nonsense.


    Left Justified


  •  

    Posting Permissions

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