I´ve implemented a proxy with a listener with the next exception :
listeners: {
exception: function () {
Ext.Msg.alert(BB.Text.getText('ERROR_TIMEOUT_TITLE'), BB.Text.getText('ERROR_TIMEOUT_MSG') + '' + PROXY_TIMEOUT, Ext.emptyFn);
Ext.redirectTo('http://www.google.es'); //for example
}
}
After the message I would like to redirect to other page / view but It is not working correctly
What am I doing wrong??
Thanks.
For Sencha Touch
You probably want to read the documentation:
Documentation
http://docs.sencha.com/touch/2.4/apidocs/#!/api/Ext.app.Application-method-redirectTo
Quote
Redirects the browser to the given url. This only affects the url after the '#'.
Read the second part very carefully.
By the way this is the same as:
MyApp.app.redirectTo('http://www.google.es')
It take it from your post that you want to redirect to a different page inside a webapp.
Can be found here
WebApp: window.location.href = "http://www.google.es"
I think below line would solve your purpose.
Ext.app.Application.redirectTo('http://www.google.es');
Related
I have a redirect that happens after a user submits a form. Users should move through the funnel like this:
SiteA.com/submit-form/ ---> SiteB.com/payment/
Problem - The redirect ignores the domain name (i.e. SiteB). It sends visitors to SiteA.com/payment/
Here's the code:
jQuery(document).ready(function(){
var tracker = ga.getAll()[0];
var linkerParam = tracker.get('linkerParam');
var url = 'https://siteB.com/payment/?' + linkerParam;
window.setTimeout(window.location = url, 4000);
});
This code is meant to append Google Analytics cross-domain tracking code. The form plugin (Formidable Pro) also has a redirect option built-in. When activated, it also redirects to the wrong page.
I'm not sure where to start looking. I had added a Category Base in Permalinks. I've just removed it, hoping this might be the problem. Any ideas / help would be greatly appreciated!
window.location return object and in strict mode you will get exception in Chrome.
Full explanation you can find here
You just need
window.setTimeout(function(){window.location.href = url}, 4000);
When I try to edit an existing product on Magento, After hitting "Save and continue edit" button , It does not save anything at all and just goes to admin dashboard .
So I checked the "Network" tab in inspect element of Chrome browser and saw this error :
Here is the highlighted file (prototype.js) lines containing 1739 :
try {
var response = new Ajax.Response(this);
if (this.options.onCreate) this.options.onCreate(response);
Ajax.Responders.dispatch('onCreate', this, response);
this.transport.open(this.method.toUpperCase(), this.url,
this.options.asynchronous);
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
this.transport.onreadystatechange = this.onStateChange.bind(this);
this.setRequestHeaders();
this.body = this.method == 'post' ? (this.options.postBody || params) : null;
/* line 1739 */ this.transport.send(this.body);
/* Force Firefox to handle ready state 4 for synchronous requests */
if (!this.options.asynchronous && this.transport.overrideMimeType)
this.onStateChange();
}
So how can I fix this problem ? What's wrong with this ?
I had the same error. The problem was in mod_secure. Changes in .htaccess don't help for me, I disabled it from cpanel for the domain and the problem was gone.
Please note, the issue appears only when the website works under https and when I use single HTML tags like in content (static block, cms pages, product attributes).
For more information please look here http://maxrice.com/magento-fixing-please-wait-error-adding-editing-products-categories/
The above image hints, that the issue is not directly code related forsay, but asset related. The fact that a simple css file is missing, and you have other network related errors before hand. It appears that prototype is not loading above which when referencing a function that library doesn't exist would cause a problem.. When did this start happening?
I am new to angularjs , so this question might seems silly to experience ones , But i really not able to perform this , can any body tell me that how to come back to app from webview after reaching to specific url , Like i am opening a window in browser for payment process so what i need is that when url in webview comes up with a success msg , i want to close the webview and get back to my application , I goggled and found a way that in $window.open() we pass three parameters and through second i can do that , but don't know how to implement that , can any one provide me a way to deal that.
i studied thi link :- Tracking a child window across page loads
i tried this function too :-
if (!$window.closed){
if($window.location.href =="http://www.magentomobileshop.com/demo/index.php/payu/index/success")
{
$window.close()
}
}
Thanks
Please have a look on it :-
Close a child window in an Android app made with Angularjs
here is my updated Answer ...and I have tested it
and its working fine
var url = "test_Url";
var socialLoginWindow = window
.open(url,
'_blank',
'location=no');
// listen to page load
// events
socialLoginWindow
.addEventListener(
'loadstart',
function(
event) {
var url = event.url;
if (url == "http://www.magentomobileshop.com/demo/index.php/payu/index/success/") {
socialLoginWindow
.close();
}
});
And here is the reference link for it :-
https://forum.ionicframework.com/t/opening-external-link-and-closing-it-at-an-event/6660/9
Here "Loadstart" will track your every change of url in window.So, the current URL can be get from event.url
Cheers !!!
Happy coding.
Use $window.close() in $window service.
You can broadcast the result to another controller like this AngularJS – Communicating Between Controllers
can you check if this will answer your question
How to close browser window in AngularJS
You can use the $window.location.href to check for the particular URL to be true
I am trying to match a token (string token) in the RSS feed using casperjs waitFor() but it does not seem to work. There are other ways (not using polling) to get around but I need to poll for it. Here is the code snippet:
casper.then(function() {
this.waitFor(function matchToken() {
return this.evaluate(function() {
if(!this.resourceExists(token)) {
this.reload();
return false;
}
return true;
});
});
});
The updates to rss url are not dynamic and hence, a refresh would be needed to check for the token. But it seems (from the access log) that I am not getting any hits (reload not working) on the rss url. Ideally, I would want to refresh the page if it doesn't see the token and then check for the token again & it should keep doing that until the waitFor times out.
I also tried using assertTextExists() instead of resourceExists() but even that did not work.
I am using PhantomJS (1.9.7) & the url is: https://secure.hyper-reach.com:488/rss/323708
The token I am looking for is --> item/272935. If you look at the url I have mentioned above, you will find this in a each guid tag. The reason why I am including "item/" also as a part of my token is so that it doesn't match any other numbers incorrectly.
evaluate() is the sandboxed page context. Anything inside of it doesn't have access to variables defined outside and this refers to window of the page and not casper. You don't need the evaluate() function here, since you don't access the page context.
The other thing is that casper.resourceExists() works on the resource meta data such as URL and request headers. It seems that you want to check the content of the resource. If you used casper.thenOpen() or casper.open() to open the RSS feed, then you can check with casper.getPageContent(), if the text exists.
The actual problem with your code is that you mix synchronous and asynchronous code in a way that won't work. waitFor() is the wrong tool for the job, because you need to reload in the middle of its execution, but the check function is called so fast that there probably won't be a complete page load to actually test it.
You need to recursively check whether the document is changed to your liking.
var tokenTrials = 0,
tokenFound = false;
function matchToken(){
if (this.getPageContent().indexOf(token) === -1) {
// token was not found
tokenTrials++;
if (tokenTrials < 50) {
this.reload().wait(1000).then(matchToken);
}
} else {
tokenFound = true;
}
}
casper.then(matchToken).then(function(){
test.assertTrue(tokenFound, "Token was found after " + tokenTrials + " trials");
});
Currently I am using message passing to send a request from my contentscript for data in localStorage and I am not having any issues with that, the content script is working as expected.
Can you do this in the other direction?
I have an object that exists in the content script that has a method called ".apply()" and I want to run it when the used clicks the option to do so.
I tried to make a listener in the content script like this:
var myLinker = new Linker();
chrome.extension.onRequest.addListener(function(request) {
if (request.method == "apply")
{
myLinker.apply("nothing");
alert("applied");
}
else
; //Do nothing
And send requests to it like this:
chrome.extension.sendRequest({method: "apply"}, function(){
alert("Tried to request");
});
I get that it is a bit of a hack, but it is the only thing I could think of, and it doesn't even work =/
Is there a way to do this?
I am pretty sure I could just inject new code into the page from the popup (I think I saw an api function for that), and then run stuff, but that would take more memory and just feels like a bad way to do it, because you would basically have the exact same code twice.
To send a message from the extension to a content script, use chrome.tabs.sendMessage instead of chrome.extension.sendRequest.
Because sendRequest has been superseded by onMessage in Chrome 20, there's no official documentation for sendRequest any more. The documentation for chrome.tabs.sendMessage can be found here. Please note that these events cannot be mixed, use either *Request or *Message.
Yes, you would use this: http://developer.chrome.com/extensions/tabs.html#method-sendMessage
Content scripts live within the DOM of the page. And each page that is open within Chrome has a tab ID associated with it -- http://developer.chrome.com/extensions/tabs.html#type-tabs.Tab
Let's say you want to send the {method: "apply"} to a page that was just opened in a new tab:
chrome.tabs.onCreated.addListener(function(tab) {
chrome.tabs.sendMessage(tab.id, { method: "apply" });
});
There are other events/methods to get the specific Tab you want to send the message to. I think there's one called getCurrent to send to the currently selected tab, check out the docs for that.