why jscript does not work in Chrome browser on iOS 7? - javascript

Please explain me why my simple script does not work in Chrome browser on iOS 7.
It works in safari, android devices, desktop browser BUT not in ios chrome...
Browser says nothing... not an error, no the message.
Why?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
alert("11");
</script>
</head>
<body>
</body>
</html>

Try to wrap 11 in quotes:
alert("11");

Related

How to make URL in instagram post to forcefully open in chrome or safari using javascript?

We have a web application which has getusermedia for camera access.
When I click on the website url on instagram or facebook mobile app, it doesn't allow the camera. How can I make the url to open in chrome or other browser instead of instagram app?
Create a shell and attempt to run a URL.
This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>HTA Test</title>
<hta:application applicationname="HTA Test" scroll="yes" singleinstance="yes">
<script type="text/javascript">
function openURL()
{
var shell = new ActiveXObject("WScript.Shell");
shell.run("http://www.google.com");
}
</script>
</head>
<body>
<input type="button" onclick="openURL()" value="Open Google">
</body>
</html>

Why Chrome fails to run jQuery

I have latest version of google chrome.The following script runs in all browsers except in google chrome. Can anyone give me any suggestion on what to do to run it in chrome.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt");
});
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<button>Get External Content</button>
</body>
</html>
Chrome by default does not allow ajax requests to access the filesystem. You can get around it by setting an argument in the shortcut that you use to open chrome, however I'd suggest instead just not testing from the filesystem to begin with. It's not too difficult to setup a very basic webserver.
For reference, file://.../myfile.html would be considered working from the filesystem, while http://localhost/myfile.html would be working from a local webserver.

How to Close Window at onload event of body at IE 8 and IE 7?

I use this code window.onload=function Print(){window.open(); window.close()} at YouPrint.aspx. It working fine at IE 9 but it does not work in IE 8 and IE 7. It shows a JavaScript error like this "Stack Flow error". Why? If you have solution, please show me the way to solve this problem. Please Help me.
Works ok for me in IE7 / IE8 using the following test file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<body onload="window.print(); window.close();">
<span>Test</span>
</body>
</html>
What doc type are you using? I've tested it with strict and that works too.
More info please...

Facebook like-box code does not display scrollbar in android as well as iphone device

I want to display facebook like-box in my app, on all the desktop browsers it's working right. When I open page on android and iphone device html scrollbar does not appear there. I am not getting what is the problem with web-kit browsers.
My code is below:
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>facebook </title>
</head>
<body>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/imoment" width="292" show_faces="true" stream="true" header="false"></fb:like-box> </body>
</html>
Try using the HTML5 version of the fb:like instead. That might make it more compliant with web-kit.

Targeting JS named opening window in Safari?

I have a static HTML page which is named via JavaScript as such: window.name = "windowname". This window opens a popup window, which contains links that target windowname.
This works as expected in IE/FF/Chrome and opens the links on the opener, however, Safari opens all links in a new window and not the opener.
Is anyone aware of a workaround or solution to this other than using JavaScript to open the links via opener.location.href? Is this a security feature of Safari or some other kind of issue?
Thanks in advance
Trying setting the "id" attribute to the same string as the name.
Not 100% sure what you problem is without being able to see your code but the following worked for me in Safari 4:
windowname:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
</head>
<body onload="window.name='windowname'">
Open
</body>
</html>
popup:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
</head>
<body>
test
</body>
</html>
No resolution for this was ever found, I had to go with a method that didn't use pop-up windows due to this.
thanks for the effort.
b

Categories

Resources