<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">There really isn't an API that exists
just for that purpose. Remember, AJAX is also just a simple page
load. <br>
<br>
One workaround is to check for the HTTP_X_REQUESTED_WITH header.
JQuery adds that in on all AJAX requests, so as long as you don't
have any modules doing their own AJAX or changing the jQuery AJAX
setup, it should work (modules invoking their own AJAX would be a
fringe case).<br>
<br>
So in hook_init, just go with something like:<br>
<br>
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {<br>
// Page requested via jQuery - AJAX. <br>
} else {<br>
// Non jQuery-AJAX page request. <br>
}<br>
<pre class="moz-signature" cols="72">Jamie Holly
<a class="moz-txt-link-freetext" href="http://www.intoxination.net">http://www.intoxination.net</a>
<a class="moz-txt-link-freetext" href="http://www.hollyit.net">http://www.hollyit.net</a></pre>
On 9/24/2012 8:28 PM, Kamal Palei wrote:<br>
</div>
<blockquote
cite="mid:CALO8XuXG+WENHizBJKDRC7akBc_g6MCTn05reQ5cdJL20Db_cg@mail.gmail.com"
type="cite">
<div>Hi Nancy</div>
<div>Thanks for help.</div>
<div> </div>
<div>Initially I thought so and gave a try for _init() hook. It
looks it gets called always either it is first time page load,
or a page refresh 9F5 in windows env) or even during AJAX
events. Even I tried _exit() hook, looks it is also invoked
always.</div>
<div> </div>
<div>I am looking for a hook that gets invoked for first time page
load and on page refresh, but should not be invoked during AJAX
events.</div>
<div> </div>
<div>So still searching if any such hooks are available that gets
invoked only during <strong>first time page load and on page
refresh</strong>.<br>
</div>
<div>Thanks</div>
<div>Kamal</div>
<div>Net Cloud Systems</div>
<div>Bangalore</div>
<div><br>
</div>
<div class="gmail_quote">On Mon, Sep 24, 2012 at 4:03 PM, Ms.
Nancy Wichmann <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>></span>
wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px
0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>
<div
style="FONT-FAMILY:arial,helvetica,sans-serif;FONT-SIZE:12pt"><a
moz-do-not-send="true"
href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_init/7"
target="_blank">http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_init/7</a>
<div><span><br>
</span></div>
<font color="#ff007f" face="bookman old style, new york,
times, serif" size="4"><i><b>Nancy<br>
</b></i></font>
<div><font face="arial, helvetica, sans-serif">Injustice
anywhere is a threat to justice everywhere. -- Dr.
Martin L. King, Jr.</font></div>
<div
style="BACKGROUND-COLOR:transparent;FONT-STYLE:normal;FONT-FAMILY:arial,helvetica,sans-serif;FONT-SIZE:16px"><br>
<blockquote style="BORDER-LEFT:rgb(16,16,255) 2px
solid;MARGIN-TOP:5px;PADDING-LEFT:5px;MARGIN-LEFT:5px">
<div
style="FONT-FAMILY:arial,helvetica,sans-serif;FONT-SIZE:12pt">
<div style="FONT-FAMILY:times new roman,new
york,times,serif;FONT-SIZE:12pt">
<div dir="ltr"><font face="Arial">
<hr size="1">
<b><span style="FONT-WEIGHT:bold">From:</span></b>
Kamal Palei</font><br>
</div>
<div class="im"><br>
<div>
<div>Hi List</div>
<div>I want to know is there any API in D7 is
invoked when a page loads for first time or
during page refresh/reload.</div>
<div>During anyother time that particular api
should not be invoked.</div>
<div> </div>
<div>I have a custom form, and I keep certain
variables in $_SESSION. During first time
page loads I want to reset the session
variables.</div>
<div>Also during page refresh (for windows IE
F5) also I want to reset session variables.<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<br>
--<br>
[ Drupal support list | <a moz-do-not-send="true"
href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a>
]<br>
</blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>