Пропустить навигацию

Do It

2 Записи автора: Jonas B. G. Wolffsen

Yesterday i had an issue that I at first did not understand.

 

Problem:

I had a form that posted data to an Eloqua form using an AJAX call. It all worked great untill we had to try it on mobile devices (WP8 worked but not Android and iPhone/iPad).

It turns out that some devices have an unrealistic approach to how much you need to cache on mobile browsers. So, unstead of posting to the url, the browser returns the cached result and did not post my data to get an updated result. The outcome was that no data was submitted to the Eloqua form and none of the processing steps was executed.

 

Solution:

You need to make sure that the page you are posting to have a different url for each call. In JavaScript, i did this by adding a datetime stamp to the url as a parameter. I also added a no cache statement to the http header of the call. See example below:

 

Before fix:

    $.ajax({
   url: 'https://secure.eloqua.com/e/f2',
   cache: false,
   type: 'POST',
   dataType: 'jsonp',
   data: data,
   success: generalsuccess(),
   error: function (data) {
   if (data['status'] != 200) {
   generalError(data);
   }
   }

 

 

After fix:

$.ajaxSetup({ type: 'POST', headers: { "cache-control": "no-cache" } });

    var currentTime = new Date();

    var n = currentTime.getTime();

    $.ajax({

   url: 'https://secure.eloqua.com/e/f2?nocache=' + n,
   cache: false,
   type: 'POST',
   headers: { "cache-control": "no-cache" },
   dataType: 'jsonp',
   data: data,
   success: function (data) { generalsuccess(data) },
   error: function (data) {
   if (data['status'] != 200) {
       generalError(data);
   }
   else {
       generalsuccess(data);
   }
   }

    }

As many of you might know, the Eloqua UI is nothing more than HTML, CSS and JavaScript. This means that you are actually able to change the look and feel and also the general functionality. For this i use GreaseMonkey as it allows me to run custom JavaScripts inside Eloqua UI.

 

The following script will add the file names as Alt values to the images inside the image browser when editing landing pages or emails. To install the script, simply use the link below, press the install button in the top right corner and press install in the pop-up. To install the script you first need GreaseMonkey installed

 

Alt names on images in Eloqua image browser for Greasemonkey

Фильтр по блогу

По дате: По метке: