SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post JS differences in Firefox and IE7

    Does anyone know why the following code would work perfectly in FireFox but error out in IE7?

    The code:

    Code:
    function readPageNumber() {
    	var split1 = document.cookie.split("=");
    	var split2 = split1[1].split("/");    <-- This is the line that errors
    	var split3 = split2[4].split(".");
    	var page = split3[0];
    	return page;
    
    }
    The error reads:

    Code:
    Error: '1' is null or not an object.

    So why does FireFox execute the code correctly and IE7 does not?

    Thanks for your time.

  2. #2
    SitePoint Member
    Join Date
    May 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured out that the problem was that IE7 is not remembering the cookie if I close the browser and open a new one up again.

    Is this the default behaviour of IE7?

  3. #3
    SitePoint Member
    Join Date
    May 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it.

    If you do not give an expiration date for the cookie, IE7 deletes it immediatly.


Bookmarks

Posting Permissions

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