I use this code for codebar scan with cellphone, on Google Chrome works but on Firefox and Samsung Browser after scan barcode an another tab are created, and +1 tab per scan.
My code:
window.top.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
I tried several ways:
window.open("zxing://scan/?ret=http://rodrigovrodrigues.tk/sjb/profile_sps.php?barid={CODE}", "_top");
window.self.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
window.parent.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
And some others...
Any friend can help me with this?
Thanks for all help.
Related
I've built a custom Google map that includes a function that either sets a link to open in Apple Maps or Google Maps:
function mapsSelector(lat, long) {
/* If on iOS, open in Apple Maps */
if ((navigator.platform.indexOf('iPhone') != -1) || (navigator.platform.indexOf('iPad') != -1)) {
window.open('http://maps.apple.com/?daddr=' + lat + ',' + long + '&dirflg=w');
/* else, use Google */
} else {
window.open('https://www.google.com/maps/dir/?api=1&destination=' + lat + ',' + long + '&travelmode=bicycling');
}
}
It works on my website when it's run as a web app or in Safari (it opens Apple Maps), but in Chrome for iOS, it briefly opens a new tab, which then immediately closes. If the same URL is opened as a standard href, it works as expected, so I imagine it's something to do with the way the function triggers the link.
To reproduce, you can go to http://nyceboarding.com/map.html, tap on any marker, and then the "Get Directions" link.
They key is iOS users use a different protocol at the beginning. Try changing the "http://" in the iOS block to "maps://" and see if that works.
Change the
www.google.com/maps/...
to
maps.google.com/maps/...
I've been having this problem with the Google bookmarks "bookmarklet" button in Chrome for several years now: it does not reliably save URLs to https://www.google.com/bookmarks so I have to double-check every link I save. The form is invoked by clicking the Google Bookmark button in the Chrome bookmarks bar that is a javascript link that opens the form. The button comes from the bottom of the Google bookmarks page itself:
Google Bookmarks page
Google Bookmark button properties
Many links will not save unless I add a suffix such as #1 to the end of the URL, and even that is not a 100% effective workaround. For example, the URL http://jsbeautifier.org/ only saves if I append the #1 in the URL field: http://jsbeautifier.org/#1.
Google Bookmarks Form
I don't know if it's an issue with the javascript, encoding the URL, or an issue on Google's end they have never fixed. Here is the full javascript that comes directly from the button properties. I added the whitespace for readability:
javascript: (function() {
var a = window,
b = document,
c = encodeURIComponent,
d = a.open("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=" + c(b.location) + "&title=" + c(b.title), "bkmk_popup", "left=" + ((a.screenX || a.screenLeft) + 10) + ",top=" + ((a.screenY || a.screenTop) + 10) + ",height=510px,width=550px,resizable=1,alwaysRaised=1");
a.setTimeout(function() {
d.focus()
}, 300)})();
Thanks in advance! :)
I have similar issue of not able to add a lot of https website into Google Bookmarks, especially those from Github or Google's Chrome Webstore. Sometimes if you change the https prefix to http, it will work, but not for all.
I guess the problem lies at the backend side, because it also fails when you try to add the URL in question directly at the Add bookmark page.
Seems Google deserted this product (originated from the time of Google Toolbar) and favors Google Chrome bookmark sync solution.
I'm trying to open mail on click in js. I'm using mailto, but in chrome you need to change the handlers settings to make it work.
My question is can I make some sort of popup that ask for persmission and changes this setting to others?
PS: to give permision for me I only found this way:
Open Gmail in Chrome and click the Protocol Handler icon overlapping-diamonds in your browser's address bar.
When prompted to "Allow Gmail to open all email links?", select "Use Gmail," and click "Done."
EDIT
My code to send the mail
$("#applyText").click(function(){
var email = 'mail#gmail.com';
var subject = 'Hire me im a genius';
var emailBody = 'Hi Sample,';
document.location = "mailto:"+email+"?
subject="+subject+"&body="+emailBody;
});
this is browser settings specific, ie. it will behave differently depending on the user's browser settings. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers, or Chrome Settings->Content Settings->Manage Handlers...
This is an answer to that question.
So to answer your question
No it is not possible because this is browser settings.
But most browsers should open it without a problem. For me this works properly.
By the way, you have some minor mistakes in your code.
Here is an working example
$("#applyText").click(function() {
var email = 'mail#gmail.com';
var subject = 'Hire me im a genius';
var emailBody = 'Hi Sample,';
document.location = "mailto:" + email + "?subject=" + subject + "&body=" + emailBody;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="applyText">Click</button>
When I click a link on chrome its getting updated query string on address bar but URL gets updated on Firefox when I refresh the page so many times.
Following is the peace of code:
var res1 ='<a href=\"#/test/" + nn.id + "\"
onclick=\"window.location.reload()test</a>'\">
$('#cnt').append(res1);
Please suggest whats wrong with the Firefox.
I have an application where i am doing new tab pop-ups in internet explorer(8,10,11) using window.open(myurl)
The pop-up triggered by a website contains a URL which is another page of that website. Problem here is that when the pop-up takes place, same webpage opens as the one from where the pop-up is being initiated.
If i copy the URL from address bar of the pop-up window and close all windows and than open that URL in new window of internet explorer only than my required page opens in the pop-up window/tab.
(Note: Same application works perfectly fine in Mozila Firefox without any issue, but it is clients requirement to run my application in IE)
Following is a method which is doing the pop-up:
function handlePhonecallScreenpop(callF, callT, callA, custid, entityN) {
var extraqs = "cf=" + callF;
extraqs += "&ct=" + callT;
extraqs += "&cd=outd";
extraqs += "&ca=" + callA;
extraqs += "&cid=" + custid;
extraqs += "&en=" + entityN;
var url = webUrl() + "/main.aspx?etn=phonecall&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs);
window.open(url, "callpop");
}
I'm guessing that you aren't setting a target window name. Which means that you're reusing the same target window for EVERY window.open() call. Try adding an arg to each of your calls:
window.open('firsturl', 'windowA');
vs.
window.open('secondurl', 'windowB');
You should see two different windows.
If you change the name to _blank it should always open in a new window.
window.open(url, "_blank");