Javascript split working incorrectly in IE - prestashop

I have one page checkout. My OPC works fine with other browsers but I get a fatal error with IE. IE's Javascript console says Object doesn't support this property or method.. The method in question is var items = field_name.split(reg) from the file: order-address.tpl.
I have no idea what is causing the problem. Because of this error, I cannot login properly from one page checkout when using IE. It seems that there are a lot of people with the same problem. What's the issue?
This error is present in 1.4.9, 1.4.10, and 1.5.3.

SOLVED. It turns out the issue is not with coding but with settings of IE.
All I had to do was reset IE from Tools => internet options => advanced => reset (including personal settings)
That did it for me. Thank you altafhussain for trying to help me out.

Related

How to detect private browsing in iOS 11 Mobile Safari or MacOS High Sierra Safari?

On the new iOS 11 Safari and MacOS High Sierra Safari, that trick of seeing if window.localStorage.setItem('test', 1); (see https://stackoverflow.com/a/17741714/1330341) throws an error no longer works, because it no longer throws an error, and it also properly sets the localStorage item. Has anyone figured out any other way to check for private browsing mode in the new versions of Safari?
Haven't actually tried it, but from reading Apple's document:
https://support.apple.com/kb/ph21413?locale=en_US
It lists various characteristics of private mode browsing (~snip):
When you use a Private Browsing window:
Each tab in the window is isolated from the others, so websites you
view in one tab can’t track your browsing in other tabs.
Safari doesn’t remember the webpages you visit or your AutoFill
information.
Safari doesn’t store your open webpages in iCloud, so they aren’t
shown when you view all your open tabs from other devices.
Your recent searches aren’t included in the results list when you use
the Smart Search field.
Items you download aren’t included in the downloads list. (The items
do remain on your computer.)
If you use Handoff, Private Browsing windows are not passed to your
iOS devices or other Mac computers.
Safari doesn’t remember changes to your cookies or other website
data. Safari also asks websites and others who provide those sites
with content (including advertisers) not to keep track of your
browsing, although it is up to the websites to honor this request.
Plug-ins that support Private Browsing stop storing cookies and other
tracking information.
From the above, in particular I found interesting that Safari specifically asks websites to "not track" the browsing. This could potentially be a mechanism to look for, to determine if using private browsing.
See this answer for an example:
Implementing Do not track in asp.net mvc
Again, haven't tested and unsure if it will work, but if not the list provides other potential options. HTH.
I find a solution here:
https://gist.github.com/cou929/7973956#gistcomment-2272103
var isPrivate = false;
try {
window.openDatabase(null, null, null, null);
} catch (_) {
isPrivate = true;
}
alert((isPrivate ? 'You\'re' : 'You aren\'t') + ' in private browsing mode');
Hope it helps :)
Quote from apple's website. https://support.apple.com/kb/ph21413?locale=en_US
Websites can’t modify information stored on your device, so services
normally available at such sites may work differently until you turn
off Private Browsing
So, store a test variable, change its value, then read the test variable.
If you get an exception, are unable to find the variable, the value didn't change or you get a null/undefined value back, they are most likely in private mode.
Alternatively, in private browsing, you have no stored search history accessible. So, redirect to a new page in your site on startup and then test if you have any previous history. If not and the fact that you are getting a Do Not Track most likely means your in private mode on safari.
Please note that I have not tested this. This is based off the information provided by Apple in the above link.
Thing that I realized is Safari throws a "Quota Exceeded" error in the Private mode. So here is what I did!
isPrivateMode: function () {
if (localStorage.length === 0) {
try {
localStorage.setItem('isLocalStorageAvaialble', 'That is being tested!');
localStorage.removeItem('isLocalStorageAvaialble');
return false;
} catch (e) {
return true;
}
}
}
Checking the length of localStorage is important for the fact that, if you are trying this method on a browser that supports localStorage, but is full, you still will get the "Quota Exceeded" error.
In private mode, the length of localStorage is always 0.
Hope this helps!

Safari extension options pages with access to background page

I'm developing a cross-platform browser extension, and have based all my code on the Chrome-way of doing this. I have counted on that the background page will be accessible from the options page, which in Safari extensions turns out to be not possible (since there is no such thing as an options-page). You can only access safari.extension.globalPage.contentWindow from within the extension popup, and the background page itself.
Now, I have an options page, which is an html-page within the extension bundle, and so far I haven't found a way for Safari to give it extension "rights". The closest I have come is adding a content script that's only added on the options page. This seems a bit silly, since the html page itself is in the extension bundle?!
Others have suggested using asynchronous ping-pong style message event handlers, and even the canLoad-mechanism (which is "only" able to run in a beforeload-event). I have been able to hack the canLoad-mechanism for synchronous messaging by forging the BeforeLoadEvent:
// Content script (run from anywhere)
var result = safari.self.tab.canLoad(new BeforeLoadEvent, "data")
-> "return value"
// Background page
safari.application.addEventListener('message', function(e) {
if ( e.name === "canLoad" )
e.message = "return value";
}, true);
It's a hack, but it works. However, I am crippled by the message transport serialization, since I need to be able access methods and data on my objects from the background page. Is there anyway around this?
Possible ways that might work but I don't know if possible:
Access options-page window-object from backgrounds page. Is that possible?
Message passing, need to bypass message serialization
Any shared/global object that I can attach objects to and fetch from the options page?
Make Safari run the options.html page from outside the content-script sandbox? It works in Chrome since they are both within the extension-bundle. It's quite annoying that safari doesn't do this too.
Run the options-page from within the popup. This is promising, but it crashes safari (which is very promising!). However, from the looks of it it's just something to do with a CSS animation in my options.html page. The biggest issue is that it has to be able to open an OAuth2 popup, but thanks to being able to programmatically open the popover, it might be a non-issue. However, this option is the most realistic, but I would rather have it open in a new tab.
Any suggestions and hackish workarounds would really help.

ReportViewer cannot shown in Firefox8 and Chrome15

I have an asp.net mvc3 project, it has some reports in aspx web pages. Everything works great in 2-3 weeks ago, but now, when I open the reports pages in FireFox8 and Chrome 15, the reports can not be displayed correctly.
In FF8, report content can be shown, but looks like css doesn't loaded, and report head control look like this:
In Chrome15, report head looks fine but content isn't shown up. I can see it has correct contents when using Firebug to view those .
Since data can ben loaded to browser, I think it maybe a browser compatibility problem, am I right?
Does anyone seeing same issues? I'm open to any suggestions.
BTW:My report viewer's version is 10.0.0.0.
Thanks.
[Edit in 12/21/2011]
FireFox
After several research on this, I have noticed when browse in firefox, server will catch an [Microsoft.Reporting.WebForms.HttpHandlerInputException: Missing URL parameter: Name], and the query string is OpType=BackImage&Version=10.0.40219.329&Color=%23ECE9D8&Name=Microsoft.Reporting.WebForms.Icons.toolbar_bk.png; path_info is Reserved.ReportViewerWebControl.axd
This may be the reason why firefox can't show page with correct CSS.
I don't know why this happens in Firefox & Chrome, while in IE everything is fine.
I've found this link shows same excpetion: http://social.msdn.microsoft.com/Forums/eu/vsreportcontrols/thread/80ce3ee8-e65b-476c-b668-ecc8e83ea73d
But I'm not sure how did he solve this, can you or somebody else gives some tip or example code to solve this?
Chrome
When browse in chrome, I found the report data is loaded into DOM, and surronded by a with id="ReportViewer1_fixedTable". Inside that element, there's a div with id="ReportViewer1_ctl09" nested in , if I remove the "height: 100%", the report can be seen.
this link http://www.apptools.com/examples/tableheight.php, explained why this 100% cannot be rendered correctly, but I'm still failed when trying to give a fixed height via CSS, the code can't be pasted here, please see this as a reference.
Thanks.
In Chrome, it's the "height=100%" problem.
Once I add following jQuery code, the report area can ben shown.
$(function () {
$("#ReportViewer1_ctl09").css("height", "auto");
});
In FireFox, the report page raise an error as following:
"Microsoft.Reporting.WebForms.HttpHandlerInputException 缺少 URL 参数: Name"
and the Query String is: "OpType=BackImage&Version=10.0.40219.329&Color=%23ECE9D8&Name=Microsoft.Reporting.WebForms.Icons.toolbar_bk.png"
according to this article, I think it's caused by a proxy that handles http request..
I checked my request, there's a "FiftyOne ..." in "Brwoser" property of "Request" ojbect.
Since fifty one is no longer used in this project, I removed it from Bin and web config, then the report can be shown in FireFox!
Hope this article can be usefule to other guys.

Permission denied error in all.js

I am using all.js for facebook implementation. I used a facebook button on signup page . by logging through facebook i am getting user name and email of facebook user into the fields on sign up page.
It's working fine on Chrome, Safari and Firefox but its giving error on IE8.
the error is in all.js line 22
{FB.UIServer._loadedNodes[a.id]=b;if(a.params)b.fbCallID=a.id;
Please help me if any one knows why this problem is occuring .
Thanks
Udham
Try this out. It worked for me, may help some one.
FB.UIServer.setLoadedNode = function (a, b){FB.UIServer._loadedNodes[a.id] = b; }
Ideally attach debugger and see which method breaks up and hack it.
This is a known bug: http://bugs.developers.facebook.net/show_bug.cgi?id=19042
It is set as CLOSED FIXED, but many users are still reporting the error in the comments area.
A hack is suggested on comment #19:
FB.init({
....
....
});
FB.UIServer.setActiveNode = function(a,b){FB.UIServer._active[a.id]=b;} // IE hack to correct FB bug
It worked for some people. I must say it didn't work for me, but I thought it was worth to mention.
I just ran into this (or a similar problem). Mine was in all.js line 22, char 3160, right after document.documentElement.style.display='none'; It was a permission denied error.
In my case, it was because the channelUrl was using a different protocol (https) than my app's iframe was being loaded under (http). I tried //mydomain.com/channel.html, but that gave me a different error. I solved it by dynamically choosing http/https for channelUrl when generating the html.
I found a solution. Already posted an answer here https://stackoverflow.com/a/8504794/287604, but for the desperate the quick fix:
FB.init({
appId: 'xxxxx',
appSecret: 'xxxxxxxxx',
status: true
cookie: true
});
// this code solves the issue
FB.UIServer.setLoadedNode = function (a, b) {
FB.UIServer._loadedNodes[a.id] = b;
};
I am still struggling with this but an odd work around I just noticed is if when using fb:login-button when setting the show-faces attribute to "true" it suddenly works fine. I tried 2 side by side fb:login buttons and the button with show faces set to either false or not included would pass back the error every time.

How to stop firefox from downloading and applying CSS via a firefox extension?

Thanks to everyone in advance -
So I have been banging on this issue for quite a while now and have burned through all my options. My current approach to canceling css requests is with nsIRequest.cancel inside of nsIWebProgressListener.onStateChange. This works most of the time, except when things are a little laggy a few will slip through and jump out of the loadgroup before I can get to them. This is obviously a dirty solution.
I have read through the following links to try and get a better idea of how to disable css before a nsIRequest is created...no dice.
https://developer.mozilla.org/en/Document_Loading_-_From_Load_Start_to_Finding_a_Handler
https://developer.mozilla.org/en/The_life_of_an_HTML_HTTP_request
https://developer.mozilla.org/en/Bird's_Eye_View_of_the_Mozilla_Framework
How do I disable css via presentation objects/interfaces? Is this possible? Inside of nsIDocShell there are a few attributes that kind of imply you can disable css via the browsers docshell - allowPlugins, allowJavascript, allowMetaRedirects, allowSubframes, allowImages.
Any suggestions?
Thanks,
Sam
The menu option that disables style sheets uses a function
setStyleDisabled(true)
so you probably can just call this function whenever new browser tab is created. Style sheets are still requested from server, but not applied. This function is not very sophisticated and doesn't mess with nsIRequest, source:
function setStyleDisabled(disabled) {
getMarkupDocumentViewer().authorStyleDisabled = disabled;
}
Digging in Web Developer Toolbar source code I have noticed that their "disable stylesheets" function loops trough all document.styleSheets and sets the disabled property to true, like:
/* if DOM content is loaded */
var sheets = document.styleSheets;
for(var i in sheets){ sheets[i].disabled = true; }
So if the key is to not apply CSS to pages, one of the above solutions should work. But if you really need to stop style sheets from being downloaded from servers, I'm affraid nsIRequest interception is your only option.
Set permissions.default.stylesheet to 2 and voilà!
You can actually use the permissions manager to block or allow stylesheets on a host-by-host basis.
Unfortunately there doesn't seem to be a simple flag like allowImages. The bugzilla adding for that is https://bugzilla.mozilla.org/show_bug.cgi?id=340746. You can now vote for it using the new bugzilla voting functionality. You can also add yourself to the CC list to be notified if anyone ever works on it.
A related request is to just give us basic HTML parsing support, which may be what you are trying to do. Unfortunately that isn't supported yet either, but you can vote/track the bugzilla for that at https://bugzilla.mozilla.org/show_bug.cgi?id=102699.
So the only workable solution seems to be some sort of interception as #pawal suggests. Here is a link that talks about the basics of interception to at least get you/us started https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads. It lists several options that I list below.
These first few seem to just be at the page/document level so I don't think they help:
Load Events (addEventListener load)
Web Progress Listeners (nsIWebProgressListener) - I tried this approach, it only seems to be called for the page itself, not for content within the page.
Document Loader Service - A global version of nsIWebProgressListener so I think it has the same problem (page level only)
That leaves two others I have not tried yet. They work globally so you would need to filter them to just the browser/pages you care about.
HTTP Observers - Seems like it might work, need to verify it calls back for CSS
Content Policy - Seems like the best option to me since it explicitly is called for CSS, someday I hope to try it :)