One of our partner sites has a webpage with a form where I enter 2-3 number fields, a captcha and then submit the form. It opens a pop-up showing the requested details.
The pop-up url is something like this
https://abc.co/xyz/gef/sample/certificate?Values=123456789|2011|A1563894a|y6zs8v|'1373550','4148114'
This thing works fine only in IE.
The same process doesn't work in Chrome or Firefox, because the ' in the url is encoded to something like this
https://abc.co/xyz/gef/sample/certificate?Values=123456789|2011|A1563894a|y6zs8v|%271373550%27,%274148114%27
I am shown an error
We are unable to process your request. Please try again later or contact Admin for further details. Try Again with Proper Inputs
So, basically the server side decoding is set right and as an end user, I am forced to use IE which sucks!
The form action happens is written in Javascript, which I can edit before the post request. Sample code:
var logNo =123456789;
var url ="/xyz/gef/sample/certificate";
var fromYear = "2011";
var logId="A1563894a";
var textID="y6zs8v";
var logNoListForCert="'1373550','4148114'";
var selectedValues =logNo+'|'+fromYear+'|'+logId+'|'+textID+'|'+logNoListForCert;
window.open('/xyz/gef/sample/certificate?selectedValues='+selectedValues,"Log_Certificate","scrollbars=yes,resizable=yes,height=500,left=0, top=0,alwaysRaised=1");
So, is there a way I can disable the encoding in Chrome & Firefox or any other workaround for this to work.
Thanks :)
Related
Have a site running on ExpressionEngine 1.7 (yeah, it's old). The issue is that when weblog preferences are set to "auto convert links and emails to URLs" we get a message that ".(JavaScript must be enabled to view this email address)" when someone posts an email in the comment section (web urls convert fine). If we turn off the conversion in preferences, the email addresses show fine but we lose the autoconverted web links. Does anyone know where we would modify the EE code that controls the url conversion to keep the web urls link conversion but stop converting the email addresses?
You might have sorted this on your own by now but just in case...
Looks like you want the auto_linker function and the encode_email function. Both can be found in typography file:
/system/core/core.typography.php
Actually before you go hacking that, it looks like you might be able to just change a value in that same file. I'm seeing:
var $encode_email = TRUE;
Try setting to FALSE.
This line looks promising too:
var $encode_type = 'javascript'; // javascript or noscript
I am using Watir Webdriver and a headless(phantomjs) browser to goto a website, login into it and click and download a file using javascript submit button.When I click on submit, I am redirected with 302 to a different address that i can see under my Network.This is url of the file to download.I am degugging using screenshots so i can see the phantomjs is working fine but after it hits on submit button, nothing happens.This whole procedure is working fine on firefox too.Using watir webdriver, how can i get that link and save it in database and redirect my phantomjs to download the file using that link?I tried reading github pull requests, official documentation and blog posts but i am unable to reach to any solution.Please provide me with suggestions or solutions. Even one word suggestion is also appreciated as it might help me to approach the problem.I have tried getting 'http request headers' but didn't succeed.I have browser.cookie.to_a and browser.headers is giving me only object like this Watir::HTMLElementCollection:0x000000024b88c0.Thank you
I was not to find solution to my question using Phantomjs but I have solved the problem using watirwebdriver(0.9.1) headless and firefox(44.0).
These are the settings i have used.
profile = Selenium::WebDriver::Firefox::Profile.new
profile['download.prompt_for_download'] = false
profile['browser.download.folderList'] = 2 # custom location
profile['browser.download.dir'] = download_directory
profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf"
profile['pdfjs.disabled'] = true
profile['pdfjs.firstRun'] = false
headless = Headless.new
headless.start
browser = Watir::Browser.new(:firefox, :profile => profile)
browser.goto 'www.google.com'
browser.window.resize_to(1280, 720)
puts browser.title
puts browser.url
When I open a url with special characters using window.location, it seems to percent encode the special characters and then opens the URL. For example
var url = "http://gramfeed.com/instagram/tags/kühl";
window.location = url;
This will result in opening a page with URL:
http://gramfeed.com/instagram/tags/k%C3%BChl
instead of:
http://gramfeed.com/instagram/tags/kühl
How do I make the URL open correctly without percent encoded characters
Here is a jsfiddle to play with the code:
http://jsfiddle.net/krisrak/aSkMR/
I do not believe the problem is with windows.location and your JavaScript. The problems is rather with how gramfeed.com interprets tags. Try this in your code:
var url = "https://www.google.com/search?q=kühl"
window.location = url;
See that special characters stay unconverted.
Now try typing http://gramfeed.com/instagram/tags/kühl directly in browser address bar - the URL gets converted.
I also came across this issue but it was an entirely different problem, although the symptoms were the same. In the end it turned out I was redirecting to a desktop website URL but for mobiles this got redirected on their server to their mobile site and it was then that it got encoded twice.
So it's always worth trying to redirect to the mobile site directly if possible and on mobile.
Hope this helps someone else :)
I have a script in my JavaScript file where I need to open a new file with a hash already set, something like:
function search(queryString){
window.location.href = "dosome.php#" + queryString
}
because dosome.php is the page where I have all the scripts for the search...
I know it sounds like a hack, but I cant spend more time rebuilding everything. I'm just trying to fix it temporarily.
It works in Firefox and Chrome, but for some reason, it doesn't work in Safari-- it doesn't send the URL with the hash. Safari sends:
domain.com/dosome.php
instead of
domain.com/dosome.php#queryvalues
What could be the problem?
If your server on dosome.php does some redirects, the hash is NOT retained, at least on Safari 4 and IE8. Chrome and Firefox work well.
In order to test this, try entering the URL http://yourdomain.com/...dosome.php#... in Safari's address bar and see if Safari keeps losing the #. (Test both with w/o www, even a simple www redirection loses the #.)
If this is the case, there is nothing you can do server-side because the #... is not sent to server; it's the client who is supposed to not lose it during navigation.
IS this done from the same page? Meaning, dosome.php?
Then try using location.hash,
location.hash = "#somestring";
I had a similar problem.
The following code was failing on an iPhone 5 in Safari:
window.location.href = 'http://example.com/result#somehash'
Safari was redirecting to just http://example.com/result/
It was working correctly in Chrome on the same phone as well as on the desktop.
I noticed it was adding the forward slash to the end and wondered if just adding a forward slash between the hash would work.
It did!
I changed my code to this and it worked:
window.location.href = 'http://example.com/result/#somehash'
Notice the / before the hash.
I have a problem with a link containing Chinese characters that is send to a javascript file in Internet Explorer. Generally that link is created by PHP and looks like this in IE:
www.example.com/%E6%B7%AC%E7%81%AB%E6%B2%B9_ASIN5034CN.pdf
In firefox it looks like this:
www.example.com/淬火油_ASIN5034CN.pdf
Both work in that direct way. I need to pass that link to a javascript that popups on the page and it will be displayed after the user entered her/his contact information.
This also works on firefox and other browsers but in IE that link is transfered to this which does not work anymore:
www.example.com/æ·¬ç«æ²¹_ASIN5034CN.pdf
I tried to do some encoding on it with encodeURIComponent but still no success. So the link is passed correctly to the javascript but it is totally screwed up only by IE.
Thx for any advice on that problem.
I found a solution that works. By encoding on the server side with PHP function urlencode the link works on javascript in IE.