How to open bookmarklet in Internet explorer popup window - javascript

I have developed the Bookmarklet for Internet Explorer. It works fine when user load it on main browser page.
The issue is, it does not work on the Pop-Up Window of the application.
Most of my users, open the link inside the main page in pop-up, but the bookmarklet is triggered from Favorite window.
The bookmarklet link is not working in pop-up window.
Is there a way to achieve this ?

Try to use code below may help to solve your issue.
<!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" dir="ltr">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>WhatsApp</title>
</head>
<body>
<script type="text/javascript">
javascript:(function(){open('https://Microsoft.com/','myWindow','toolbar=yes, menubar=yes, resizable=yes, width=650,height=900,top=0,left=1270');})()
</script>
</body>
</html>

Related

javascript document ready function

And once again I am stuck in the learning process. I am trying to animate a background of a site using the help provided here. But I am a little stuck. As I am teaching myself javascript (to replace basic actionscript). I like to write line by line instead of copying an pasting so I can understand how things work.
This is what I have so far:
<!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"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Site</title>
<script type="text/javascript">
$(document).ready(function(){
window.alert("function started");
});
</script>
</head>
<body>
</body>
</html>
As you can see the alert window should pop up as the function is started, but it doesn't. Is there a reason why this happens or should I just set up a body onLoad function to handle what I want to do when the page loads?
You forgot to include the jQuery javascript API in your page. It should be included before you use the $() function (which is an alias for the jQuery() function in this case.)
If you check your browser's Javascript console you probably have an exception for trying to use undefined $. (In IE a handy trick while doing web development is to enable the Advanced option for "Display a notification for every script error," but this can get annoying when visiting other sites because lots of developers are lousy about identifying and fixing unhandled JS exceptions! Modern browsers usually use 'F12' (in the US at least), to open the developer tools for debugging Javascript, etc.)
Corrected code:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Site</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
window.alert("function started");
});
</script>
</head>
<body>
</body>
</html>
This example uses the Google-hosted jQuery API, but you may also choose to download jQuery from http://jquery.com
Demo
http://jsfiddle.net/dvADs/
You are missing library reference~! like this
<script type='text/javascript' src='//code.jquery.com/jquery-2.0.2.js'></script>
Hope rest feeds your needs :)
Basics: http://jqfundamentals.com/chapter/jquery-basics
JQ CDN: http://jquery.com/download/
$(document).ready(function(){
window.alert("function started");
});
You are not first loading jQuery. jQuery is a library that you are trying to call by using the $. You can download it here: http://jquery.com/download/. Make sure you load jQuery before the javascript code.

IE ignores my js

I have validated this html. When I open it in a IE browser I cant see any alert. In other browsers I can. Any ideas why this is happening. HTML is valid according to http://validator.w3.org/check.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>hello</title>
</head>
<body>
<script type="text/javascript">alert("hallo");</script>
<div>Hello</div>
</body>
</html>
If you are opening the file locally in IE, you will a find confirmation message from IE saying
"Allow blocked content"
Click on it and your code will run.

Javascript coding for zopim live chat not visible in IE8

In my site pages, I used a javascript coding for live chat from zopim. This works fine in chrome and Firefox. The live chat window is displaying and can able to chat with that window.
But in IE the chat window is not visible. But when using inspect element in IE it highlights the div for the chat window. I tried some other coding from zopim. But I didn't get the result in IE.
I dont know what is the problem. Anybody can help me to solve this issue for live chat. The coding I used
<!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">
<head>
<title>Sample test zopim</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
Sample test Zopim
<!--Start of Zopim Live Chat Script--> <script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8'); $.src='//cdn.zopim.com/?11THLdRhqxNgdgRiWyGwwAv8e4KF6S6G';z.t=+new Date;$. type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script> <!--End of Zopim Live Chat Script-->
</body>
</html>
It seems to me that its a browser compatibility issue Upgrade and try other IE version hope it works. If the problem is still remain you can communicate with zopim help support team.

External CSS and JavaScript files not caching?

All of the sudden (at least so it seems), both Chrome and Firefox behave very strangely when it comes to viewing the source code of a web page. While normally I should be seeing the source like:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dynamic Map Application - HTML & JavaScript</title>
<link rel="stylesheet" type="text/css" href="resources/css/styles.css" />
<link rel="stylesheet" type="text/css" href="resources/css/colorbox.css" />
</head>
...
I now see it like (copied exactly as the browser shows it to me):
<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Dynamic Map Application - HTML & JavaScript</title> <style type="text/css" style="display:none">/**
* CSS Reset styles
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
margin:0;
padding:0;
}
...
As if the style sheets and scripts are not external.
This is not normal behavior and it did not happen before. And it's affecting how the browser caches external files (i.e. it doesn't).
Can anyone help with this issue?
Thanks in advance!
I had a similar problem that was caused by a proxy. Make sure you are not using one, directly or indirectly (perhaps your work place installed one).

Javascript doesn't execute in Safari when placed in HEAD

I'm having a problem with Javascript not executing when placed in the HEAD section of an HTML page in the Safari browser. It works fine in IE, Chrome and Firefox, but with Safari I have to move it down to between the and tags.
Anyone know if this is a known issue?
PS. The HTML and Javascript is contained in .PHP files, if that makes a difference.
Update:
Code I'm using to test:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
alert("In HEAD Tag");
</script>
</head>
<body>
<div id="innerthumbcontainer">
Test
</div>
</body>
</html>
If I open the page containing this directly it seems to work. But as soon as I load this into a DIV from another page it does not fire in Safari. In all the other browsers it does work though.
I think I would have heard about it if that was a general problem, you probably have a syntax error in your HTML or something, which for some reason makes Safari give up. Post your code, preferably the HTML output, and we'll have a chance of telling you what is wrong.
Edit: As far as I understand you are trying to use a complete HTML page as content for a div, you really can't do that. Depending on what exactly you are trying to achieve you could either use an iframe, or you could cut out the html, header and body tags.

Categories