-1

We are using CrossRider to develop an extension for Internet Explorer. I'm using debug mode with the following code in extension.js:

/************************************************************************************
  This is your Page Code. The appAPI.ready() code block will be executed on every page load.
  For more information please visit our docs site: http://docs.crossrider.com
*************************************************************************************/

appAPI.ready(function($) {
    if (appAPI.isMatchPages("mail.google.com/*")) {
        alert('mail.google.com');
    } else if (appAPI.isMatchPages("*.mail.yahoo.com/*")) {
        alert('mail.yahoo.com');
    } else if (appAPI.isMatchPages("*.mail.live.com/*")) {
        alert('mail.live.com');
    } else if (appAPI.isMatchPages("*.webmail.aol.com/*", "*.mail.aol.com/*", "mail.aol.com/*")) {
        alert('mail.aol.com');
    } else if (appAPI.isMatchPages("http://mail.rambler.ru/mail/compose.cgi*")) {
        alert('mail.rambler.ru');
    }
});

I receive the alerts when I open new tabs or refresh pages at https://mail.google.com/mail/?pli=1#inbox, https://us-mg6.mail.yahoo.com/neo/launch?.rand=ch8u1egr4gthf and https://mail.aol.com/38815-816/aol-6/en-us/suite.aspx, but when I open a tab at https://bay180.mail.live.com/default.aspx - I receive the alert only when I open a new tab, not when I refresh the page (I didn't check http://mail.rambler.ru/mail/compose.cgi). What is the problem? Is it a bug in CrossRider or is it a feature? I don't understand why there is no alert when refreshing the page.

Uri
  • 2,992
  • 8
  • 43
  • 86
  • I tested your code using my Live Mail account and received the alert as expected. [**Disclosure**: I am a Crossrider employee] – Shlomo Nov 04 '14 at 12:46
  • @Shlomo on my computer with Internet Explorer 11 on Windows I don't receive the alert on https://bay180.mail.live.com/default.aspx after refreshing the page. – Uri Nov 04 '14 at 13:55
  • I tested on Win 8.1/IE 11. If you provide your extension id and the file/line number where your code snippet can be found, I'm happy to test it for you. – Shlomo Nov 04 '14 at 14:42
  • @Shlomo The link is http://crossrider.com/apps/43889/ide, I think the id is 43889? I removed all the code from both extension.js and background.js, except the above code. But I tested it in debug mode, I'm not sure if this bug exists in production/staging mode. I'm also using Windows 8.1. – Uri Nov 04 '14 at 15:05
  • I'll take a look either later today or tomorrow morning. In the meantime, can you test in staging or production to see if it's a specific Debug Mode issue and report back your findings? Thanks – Shlomo Nov 04 '14 at 15:07
  • @Shlomo I tested in staging without using debug mode and the same error exists (I don't receive an alert after refreshing https://bay180.mail.live.com/default.aspx). I didn't test in production but we are not ready for production yet. – Uri Nov 04 '14 at 15:16
  • I installed extension 43889 on IE 11/Win 8.1 and received the alert as expected ([43889-Alert](http://content.screencast.com/users/CrossriderSupport/folders/Snagit/media/612468c3-5d02-408e-ba8b-d0f579092d44/11.05.2014-11.05.png">), [43889-Manage-AddOns](http://content.screencast.com/users/CrossriderSupport/folders/Snagit/media/00f105af-deed-45a0-b01f-2b5249970ada/11.05.2014-11.00.png">)). Can you try on another computer? – Shlomo Nov 05 '14 at 09:13
  • @Shlomo I checked with another computer with Windows 8.1 and Internet Explorer 11. This bug appears about one third of the times I refreshed *.mail.live.com (about 7 of 20 times I refreshed there was no alert). – Uri Nov 05 '14 at 09:38
  • It works every time for me. I'm guessing at your site some of the content hasn't completed loading and hence [appAPI.ready](http://docs.crossrider.com/#!/api/appAPI-method-ready) (like [jQuery.ready](http://api.jquery.com/ready/)) isn't triggered (or is triggered only later when the content completes rendering). If you need the response more immediately, try moving your code outside appAPI.ready. – Shlomo Nov 05 '14 at 13:19

1 Answers1

3

First i must start with recommendations regarding crossrider development

TL;TR

To debug your specific case i would use that code: (you can even run it via chrome console as mentioned above)

console.log('extension code run start');
appAPI.ready(function($) {

    console.log('extension ready');
    console.log('extension id:' + appAPI.appInfo.id);
    console.log('extension env:' + appAPI.appInfo.environment);
    console.log('extension version:' + appAPI.appInfo.version);

    var urlPatterns = [
        'mail.google.com/*',
        '*.mail.yahoo.com/*',
        '*.mail.live.com/*',
        '*.webmail.aol.com/*',
        '*.mail.aol.com/*',
        'mail.aol.com/*',
        'http://mail.rambler.ru/mail/compose.cgi*',
        'mail.rambler.ru'
    ], i;

    for (i = 0; i < urlPatterns.length; i ++) {
        console.log(urlPatterns[i] + '--' + appAPI.isMatchPages(urlPatterns[i]));
    }
});

Imo it is possible that i Crossrider behaves differently after page reload. not sure if that's the case here.

Community
  • 1
  • 1
Bnaya
  • 765
  • 6
  • 15
  • Thanks, but I can't run the extension in debug mode in Google Chrome, I get this error message: "`[blocked] The page at 'https://mail.google.com/mail/u/0/#inbox' was loaded over HTTPS, but ran insecure content from 'http://localhost/Projects/Thin%20Client/trunk/CrossRider/extension.js?rnd=1416128179974': this content should also be loaded over HTTPS.`". – Uri Nov 16 '14 at 09:00
  • Try to run your server also with HTTPS,even without certificate. then navigate to it and approve the warning message. then i belive it will work – Bnaya Nov 16 '14 at 09:13