Chrome issue - Open mobile SMS app by clicking URL - javascript

I need to open the sms application of mobile with prefilled body and recipient by clicking on a URL.
so I wrote this code and it is working fine in firefox.
But it is not working in chrome.
<html>
<head>
<script type="text/javascript">
function f(){
window.location="sms://+12345?body=1234";}
</script>
</head>
<body onload="f();">
</body>
</html>
Any idea to fix?

Related

How to do redirect to others browser from IE?

<!DOCTYPE html">
<html lang="en">
<head>
<meta charset="utf-8">
<title> Redirecting EWS Manager to Chrome </title>
<h1>Browser Redirecting ......</h1>
<script type="text/javascript">
{ varshell = new AciveXObject("WScript.Shell");
shell.run("Chrome //new Link here//");
window.location.replace("#old link the default browser"):}
setTimeot("pageRedirect()",3000);
</script>
</head?
</html>
Above code is for redirecting and named as redirect.html. But it only works when I open my website in IE so that it will redirect to Chrome. But If I open in Chrome, it will only shows Redirecting to Chrome. It does't work in Chrome, It only works in IE. Opening in IE and redirecting to Chrome is works. But reopening in Chrome doesn't work. May I know why and can you please show me a way to fix it?
echo " <tr><td class=\"left_padding\"><a class=info href=\"http://sgewsweb.amk.st.com:8080/web/system/usermgr7/redirect_edge.html\" >User Manager<span>EWS Administrator</span></a></td></tr>";
This link is from my default homepage. When I click to the tab, it opens in Chrome. Some says I have to do with onclick function but I have no idea how to use it. Can you please fix it for me?
enter image description here
When I open Chrome, it pperars like this.
You can try redirecting through header location in php. It will work in all browsers. However, it needs to be placed before any html output.
<?php header('Location: newlink.php'); ?>

Open Android mobile app through javascript click function

I am trying to open an installed android mobile application via html page in Chrome browser through javascript or jQuery click function.
It seems an anchor tag tap is working fine and opening an installed app but it's not allowing when I am trying to open an app with javascript click function, href is same still it's not working.
Here is the code:
<!doctype html>
<html>
<head>
<script src="assets/js/jquery-3.3.1.min.js"></script>
</head>
<body>
<a id="openApp" href="intent://adjustify/#Intent;scheme=https;package=com.adjustify.android;end">click me 65</a>
</body>
<script>
$(document).ready(function(){
setTimeout(function(){
document.getElementById('openApp').click();
}, 2000);
});
</script>
</html>
Tried many things but no luck, any suggestion appreciated.
try this one $(document).ready(function(){ $('#openApp').click();});

javascript in mobile web browsers

I have this very simple html file.
<!doctype html>
<html>
<head>
</head>
<body>
<script>alert("hi");</script>
</body>
</html>
This usually runs fine in Firefox and Google Chrome on my laptop. But when I run this in Safari in an iPhone device and Google Chrome on an Android device, the JavaScript code doesn't run. That is, no alert appears. This is extremely unusual for me. Do we need to change JavaScript code when running on mobile devices? What should I do?
(function(){
window.alert('hi')
})()
<html>
<head>
</head>
<body>
</body>
<script src="aJSfile.js"></script>
</html>
Add window to alert so that it says window.alert('hi') also see the core window functions supported by most browsers
https://developer.mozilla.org/en-US/docs/Web/API/Window/alert

SWF downloads twice in IE

I see SWFs download twice in IE, but not in Chrome. I'm using IE 11. I can see the download requests in the F12 dev tools Network tab and in server access logs. Below is a simple example that exhibits the problem. I'm using swfobject 2.2. I've tried calling swfobject.switchOffAutoHideShow() before calling swfobject.embedSWF(), but that doesn't help.
You can test this by putting the HTML and swfobject.js in the same directory and browsing from the disk, so you don't need an HTTP server to test/reproduce this.
Does anyone know why this happens and how to stop the second download?
<!DOCTYPE html>
<html>
<head>
<title>My Version</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://www.adobe.com/swf/software/flash/about/flashAbout_info_small.swf",
"flashInfo", "100%", "100%", "9.0.0");
</script>
</head>
<body>
<div id="flashInfo">
<p>No flash here. Move along.</p>
</div>
</body>
</html>

PhoneGap Opening a PDF error "document could not be opened"

I am currently using PhoneGap. I am using eclipse as my IDE. The tablet that I am developing on is a Samsung Galaxy Tab 10.1, android version 4.0.4.
Now I am trying to open a PDF on the device through my app. However it is not working. I followed the tutorial on this page, https://github.com/markeeftb/FileOpener.
Here are the changes I have made.
-> In the src folder, I made a new folder called com.phonegap.plugins.fileopener -> I copied and pasted the FileOpener.java file into the folder. -> Then in the config.xml file located in the xml folder, I added the line
<plugin name="FileOpener" value="com.phonegap.plugins.fileopener.FileOpener"/>
-> I also added the line
<script type="text/javascript" charset="utf-8" src="fileopener.js"></script>
into my index.html file
Here is the code for index.html
<!DOCTYPE HTML>
<html>
<head>
<title> PhoneGap </title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="fileopener.js"></script>
</head>
<body>
<h1>PDF Open Tester</h1>
open
</body>
</html>
Just as further information, once I have connected the tablet on my computer, when I right click on 1.pdf and check properties the file location is Computer\GT-P7510\Tablet
When I run this project on the tablet and click on the open link. The adobe reader app opens up on the home page saying "The document could not be opened". What is going wrong why is the pdf not opening with Adobe Reader? Please help if you can I would really appreciate it.
-----------------------------------After Edit 1-----------------------------------------------------------------------------------
I found the specfic error that is happening. The error is Object # has no method 'exec'
The FileOpener pluggin is expecting a URI, and you are passing it a filepath.
change:
'/sdcard/Course Content Files/1.pdf'
to:
'file:///sdcard/Course Content Files/1.pdf'

Categories

Resources