tag:blogger.com,1999:blog-41628744141389890852024-03-12T22:43:14.111+00:00I write my day to day experiences with technology and web development hereUnknownnoreply@blogger.comBlogger11125tag:blogger.com,1999:blog-4162874414138989085.post-4515563939833743042015-02-04T07:47:00.002+00:002015-02-04T08:24:44.133+00:00Maven, How To's<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="sm-blog-body">
<p> On this page I will compile a list of How To's for using Maven </p>
<h3>How to force update of dependencies while building </h3>
<div class="code">
mvn clean install -U
</div>
<h3>How to add multiple repositories </h3>
At times some of the dependent jars may not be available in the default maven repository, in such cases we can configure maven to look into another repository as follows
<div class="code">
<code>
<repositories>
<repository>
<id>Maven-Alfresco</id>
<name>MAF</name>
<url>https://maven.alfresco.com/nexus/content/groups/public</url>
</repository>
</repositories>
</project>
</code>
</div>
</div>
<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-76975140694881654562014-09-19T08:56:00.001+01:002014-09-19T08:56:48.469+01:00Where is php.ini on my computer<div class="sm-blog-body">
Often times we end up asking ourselves where is php.ini on my computer.
Here is one way of finding out
Run
<span class="code">
php -i
</span>
on your computer.
<span class="code">
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /Library/Server/Web/Config/php
</span>
Configuration file path will tell you the location of configuration file. Alternatively you can also run
<span class="code">
php --ini
</span>
to get the configuration file info.
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-16047398913493142792013-12-11T11:38:00.001+00:002014-04-02T11:35:24.412+01:00How to enable or disable auto capitalization and auto correction in iOS programmatically<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="sm-blog-body">
<br />
Usually auto capitalization and auto correction are enabled in iOS, however at times there will be a need to disable auto capitalization and auto correction. For example when user is setting up his account or when user is entering his password. This can be done either programmatically or can be done in the story board. Let us explore how to do this programmatically.
<br />
<br />
In iOS <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html">UITextInputTraits</a> protocol defines the features that are associated with the key board input. This protocol is implemented by <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextField_Class/Reference/UITextField.html#//apple_ref/occ/cl/UITextField">UITextField</a> and <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextView_Class/Reference/UITextView.html#//apple_ref/occ/cl/UITextView">UITextView</a>. Property <b>autocapitalizationType</b> determines the characteristics of auto capitalization and property <b>autocorrectionType</b> determines the characteristics of auto correction.
To disable auto capitalization in text view
<br />
<div class="code">
UITextView *text = [[UITextView alloc] initWithFrame:CGRectMake(130.0, 10.0, 150.0, 100.0)];
text.autocapitalizationType = UITextAutocapitalizationTypeNone;
</div>
Similarly to disable auto capitalization in text field
<br />
<div class="code">
UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(100.0, 10.0, 150.0, 30.0)];
field.autocapitalizationType = UITextAutocapitalizationTypeNone;
</div>
To disable auto correction in text view
<br />
<div class="code">
UITextView *text = [[UITextView alloc] initWithFrame:CGRectMake(130.0, 10.0, 150.0, 100.0)];
text.autocorrectionType = UITextAutocorrectionTypeNo;
</div>
<br />
Similarly to disable auto correction in text field
<br />
<div class="code">
UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(100.0, 10.0, 150.0, 30.0)];
field.autocorrectionType = UITextAutocorrectionTypeNo;
</div>
<div class="reference">
<a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html">Refer to Apple documentation here for more details. </a>
<br/><br/>
</div>
</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-79461733143390957512013-12-04T11:05:00.000+00:002013-12-04T11:19:37.643+00:00Fix for iOS application that crashes in the simulator due to core data changes.<div class="sm-blog-body">
Often it is possible that we make changes to the core data model during the development process. Whenever data model changes, existing version of the application will crash in the simulator due to the fact that the data in the persistent store is unusable in the new version of the application. To fix this select<b> Reset Content and Settings </b> option in the <b> iOS simulator </b>.
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-3620428521503768822013-08-29T07:58:00.001+01:002013-09-03T06:03:59.587+01:00iOS Text View Recipes<div class="sm-blog-body">
<b>How to make a text view not editable but scrollable. </b>
<br/><br/>
At times, specially in the view only mode, we would like a text view to be scrollable but not editable. It can be achieved as follows.
<div class="code">
...
UITextView *text = [[UITextView alloc] initWithFrame:CGRectMake(90.0, 5.0, 200.0, 100.0)];
//This is to make text non editable but scrollable
<b>
text.editable = NO;
text.scrollEnabled = YES;
text.userInteractionEnabled = YES;
</b>
....
</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-12108301110996067262013-08-24T06:06:00.002+01:002013-08-31T05:49:24.432+01:00iOS Table View Recipes<div dir="ltr" trbidi="on" class="sm-blog-body">
<b> How to set table view in editable mode programmatically. </b>
<br/> <br/>
By default table view in iOS is set to be in non editable mode. Often it is required to set table view in editable mode programmatically, it can be done by setting editing property on table view to be yes.
<br/>
For example :
<div class="code">
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.editing = YES;
}
</div>
<br/><br/>
<b>How to conditionally enable or disable editing of certain table cells. </b>
<br/><br/>
It is possible to configure certain cells in table view to be editable while others are not. It can be achieved by implementing the method canEditRowAtIndexPath
<br/>
For example :
<br/>
<div class="code">
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row < 2) {
return NO; //Cell is not editable
} else {
return YES; //Cell is editable
}
}
</div>
<b>How to remove cell separator line for table cells. </b>
<br/><br/>
By default table cells are separated by line, these lines can be removed by setting separatorStyle property on table view.
<br/>
For example:
<br/>
<div class="code">
- (void)viewDidLoad
{
[super viewDidLoad];
<b> self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; </b>
}
</div>
<b>How to reset content in a table view cell. </b>
<br/><br/>
As per apple documentation "The table view's delegate in tableView:cellForRowAtIndexPath: should always reset all content when reusing a cell"
<br/>
Content can be reset as shown below.
<br/>
<div class="code">
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"PasswordDetailsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
//Reset the content in cell
[[cell textLabel] setText:@"" ];
[[cell detailTextLabel] setText:@""];
NSArray *subviews = [cell.contentView subviews];
for(UIView *view in subviews){
[view removeFromSuperview];
}
}
</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-75564877629438304352013-06-13T12:28:00.000+01:002013-06-25T11:21:48.518+01:00Track clicks on downloadable links<div class="sm-blog-body">
<p>
We always strive to make our web sites better by understanding the usage of the site.
One such metric is to check how many times a given file is downloaded, or how many times a given button is clicked.
In this article we will explore a way to measure the number of times a file is downloaded using
Google Analytics tracking.
</p>
<p>
Let's say we have a link to download zip file.
<br/>
<div class="code"> <a href="/download.zip">Download zip file.</a></div>
<br>
We would like to know the number of times the file is downloaded.
This can be achieved by adding a piece of inline javascript snippet to the onclick event.
Assuming we already have basic Google Analytics setup,
let's change the download link to as follows.
<div class="code"><a href="/download.zip" target="_blank" onclick="_gaq.push(['_trackEvent','event_category','event_action']);">Download zip file </a>"</div>
Change "event_category" and "event_action" to names of your choice, as these will be reflected in Google Analytics.
These statistics can be seen in Google Analytics under "Content" -> "Events" -> "Overview"
</p>
<p>
<div class="reference"><b> Reference : </b> https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide</div>
</p>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-33001318970280378312012-12-03T13:03:00.002+00:002012-12-03T13:04:39.524+00:00IF condition in SQL SELECT statement<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">As developers we often write SQL SELECT statements for querying data. Even though we use WHERE clauses to filter data, some times this is not sufficient.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Let us assume a scenario, </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">select user.name from user where user.id = 123;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The query returns null for name. </span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Let us assume we want "John" to be returned whenever name is null. We can achieve this as shown below.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">select </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">CASE WHEN user.name is null THEN 'John' ELSE user.name END</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">from user where user.id = 123;</span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-90463717253854478702012-11-04T16:12:00.000+00:002012-11-05T05:53:15.478+00:00How to restart apache on Mac OS X<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Mac comes bundled with Apache web server. To start, stop or restart Apache from command line :</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To start :</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo /usr/sbin/apachectl start</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">or</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo httpd -k start</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To stop :</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo /usr/sbin/apachectl stop</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">or</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo httpd -k stop</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To restart :</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo /usr/sbin/apachectl restart</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">or </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo httpd -k restart</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-68596307237604971082012-10-19T09:24:00.000+01:002013-06-25T11:22:05.964+01:00How to read from a file and write to another file in Java<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Often we have requirements to read from a file and write to another file or to read from a temporary file and persist the data to a file on disk. </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">For convenience sake let's assume that temporary file is located at </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;">/SM/temp/uploadedFile.jpg</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">and we need to write file to the location</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">/SM/profiles/images</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Step 1 : Open a file input stream to read bytes from the file</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">java.io.FileInputStream fis = new FileInputStream("/SM/temp/uploadedFile.jpg");</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Step 2: Open an output stream to write to a file</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">java.io.FileOutputStream fos = new FileOutputStream("/SM/profiles/images/newImage.jpg");</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Step 3: Read the bytes from input stream and write to the output stream</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<span class="Apple-style-span" style="color: #999999; font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"> while (fis.available() > 0) {</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"> fose.write(fis.read());</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Step 4 : Finally flush the stream and close the streams</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;">fose.flush();</span><br />
<span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;">fise.close();</span><br />
<span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;">fose.close();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It is very important to close the streams once we finish using them. It will release any system resources that are used during the process. </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4162874414138989085.post-53553662800922721572012-09-22T18:56:00.000+01:002012-10-19T06:12:48.821+01:00Setting up Google Analytics tracking for cross domain, dynamically generated iframe content<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">There are barely any websites that don't use Google Analytics tracking to monitor activities on their site. I don't have to explain what you can achieve with Google Analytics tracking, however the purpose of this post is to share my experience with setting up tracking for cross domain dynamically loaded iFrame content. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Let's say you have a page www.mainpage.com that loads content in iFrame, from another domain www.contentforiframe.com, now you want to track the user flow between your main site and the page you are loading in iFrame. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Assuming you are using async Google Analytics script, update Google Analytics script, on the main site www.mainpage.com as shown below :</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: #351c75;">...........<br />_gaq.push(['_setAccount', 'UA-XXXXXX-X']); <br /><b>_gaq.push(['_setAllowLinker', true]); </b><br />_gaq.push(['_trackPageview']); <br />...........</span></span><br />
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">"<span class="Apple-style-span" style="color: #351c75;">_gaq.push(['_setAllowLinker', true]);</span><b> " </b>is responsible for enabling cross domain tracking. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">On the site containing iFrame content i.e on www.contentforiframe.com, update Google Analytics script as shown below</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">.........</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">_gaq.push(['_setAccount', 'UA-XXXXXX-X']);<br /><b>_gaq.push(['_setAllowLinker', true]); </b></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;"><b></b></span></div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 1px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: -2px;">
<b><span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif; font-size: small;"><b>_gaq.push(['_setDomainName', 'none']);</b></span></b></div>
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">_gaq.push(['_trackPageview']); </span><br />
<div style="text-align: left;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">..........</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">So, far we have enabled cross domain tracking between two sites, next step will be to send cookie information from one site to another via URL. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Assuming iFrame is dynamically loaded via javascript, we can add cookie information to iFrame URL as shown below</span></div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /><span class="Apple-style-span" style="color: #351c75;">var iframesLoadEvent = self.setInterval(function() { <br />var iframes = $("iframe[id*='easyXDM']"); <br /><br />if(iframes.length > 0) { <br /><br />window.clearInterval(iframesLoadEvent);</span></span><br />
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: #e69138;">//Google code to append cookie information to the URL</span><br /><b style="color: #351c75;">_gaq.push(function() { <br />var pageTracker = _gat._getTrackerByName(); <br />var iframe = iframes[0]; </b></span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: #e69138;">//Get the original iframe URL</span><br /><b style="color: #351c75;">var iFrameUrl = iframe.src; </b></span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: #e69138;">//Ask Google Analytics to add cookie information to the url and update iFrame with the new URL</span><br /><b style="color: #351c75;">iframe.src = pageTracker._getLinkerUrl(iFrameUrl); </b><br /><b style="color: #351c75;">}); </b><br /><br /><span class="Apple-style-span" style="color: #351c75;">}},10);</span></span><br />
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Even though all this looks very simple once sorted, it took me days to sort it out.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Note : Internet Explorer does not allow third party cookies, which means even if you have set up cross domain tracking properly, it will work on Firefox, Safari and Chrome, but not in Internet Explorer.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">I've overcome this problem by adding a p3p header for the response from site retrieved in iFrame. For example add following P3P header to response page from the site </span><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">www.contentforiframe.com</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span>
<span class="Apple-style-span" style="-webkit-text-size-adjust: none; background-color: #f3f3f3; white-space: nowrap;"><span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;"></span></span><br />
<div class="header-name" style="box-sizing: border-box; display: inline-block; font-weight: bold; margin-right: 0.5em; vertical-align: top; white-space: pre-wrap;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">P3P:</span></div>
<div class="header-value source-code" style="box-sizing: border-box; display: inline; margin-right: 100px; margin-top: 1px; white-space: pre-wrap; word-break: break-all;">
<span class="Apple-style-span" style="color: #351c75; font-family: Times, 'Times New Roman', serif;">CP="NOI DEV PSA PSD IVA IVD OTP OUR IND OTC"</span></div>
<br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="-webkit-text-size-adjust: none; white-space: pre;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"><br /></span></div>
</div>
</div>
Unknownnoreply@blogger.com0