|
Posted by Jerry Stuckle on 01/18/07 10:45
Frances wrote:
> Jerry Stuckle wrote:
>
>> fmaxwell@gmail.com wrote:
>>> Dear Group
>>>
>>> I have a very frustrating problem. I have been trying to make it more
>>> difficult to access external javascript files by using PHP sessions.
>>>
>>> This works beautifully locally (both in IE6 and IE7) and online in IE7,
>>> but frustratingly, online in IE6, the javascript does not render on the
>>> page, unless you refresh the page.
>>>
>>> Is there something different about the way IE6 handles sessions? Why
>>> would it work locally but not online?
>>>
>>> Any help would be very much appreciated.
>>>
>>> Thanks
>>> Frances
>>>
>> Sorry, my crystal ball is broken today. We need more information - like
>> maybe the code your using.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstucklex@attglobal.net
>> ==================
>
> Dear Jerry
>
> Thanks for replying. Sorry to hear about your crystal ball :-)
>
> I guess I was hoping to blame it on some error with IE6 session
> handling, but it must be my fault then. This is my code:
>
> In the template:
>
> session_cache_limiter('none');
> $_SESSION["allow_script"] = "allow_script";
>
> In the external javascript file:
>
> <?php
> session_start();
> if (isset($_SESSION["allow_script"]))
> {
> if($_SESSION["allow_script"] == "allow_script")
> {
> ?>
>
> javascript code here
>
> <?
> unset($_SESSION["allow_script"]);
> }
> }
> else
> {
> header("HTTP/1.0 404 Not Found");
> }
> exit();
> ?>
>
> I can use other PHP code in the external javascript file, so that is
> not the problem. It appears to me that it does not like any reference
> to the session. This is only a problem in IE6. I have tried it
> without unsetting the variable at the end and also without exit(). No
> joy.
>
> Thanks so much for any pointers
> Frances
>
>
(Top posting fixed)
Hi, Francis,
Hmmm, strange.
I guess the first question would be - are you sure session_start() is
being called before *anything* is output?
But unfortunately, you don't show enough to make any sense. When you
indicate and "external javascript file" - how are you loading the file?
If you're including the file (i.e. php include or require statement),
that's fine. But if you're linking to the file, the link is processed
by the browser at some time - and it may well be after the page has been
loaded. So you wouldn't see it in your main page code.
P.S. Please don't top post.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|