Insert Table
The code works perfectly fine in Google Chrome but in Internet Explorer and Firefox it just redirects to a page with the text "block"
You should never use the javascript: pseudoprotocol. Use the click event for this. Besides, also watch the quotes.
Here's the correct approach:
Insert Table
Note that I (optionally) returned false here to block the default action.
Your qoutes are wrong:
javascript:document.getElementById('create_table').style.display=''block
It must be:
javascript:document.getElementById('create_table').style.display='block'
But you shouldn’t use javascript: pseudo-protocol anyway. Better use JavaScript to only enrich your document.
Related
I have a link:
someText
it works fine everywhere except ie(i try ie11) i have this error
This page can’t be displayed.
Make sure the web address //ieframe.dll/dnserror.htm# is correct.
How can i solve this?
If you use a javascript URI scheme in a HTML href attribute, this is different to using an onclick event handler.
In IE, the result of executing that JavaScript will replace the currently loaded document.
To avoid this (without refactoring your code to not do things this way), you can end your href with the javascript operator void, which tells your javascript to return nothing, at all (well, undefined).
Then IE will stay on the current page.
<a href="javascript:someObject.someFunction(); void 0" ...
...and you probably don't want the target="_blank" since you're telling a new window to run your JavaScript code, and your function is not available in that window.
I would do this instead:
someText
It will open a new tab as you intended, and it works in chrome, firefox and IE.
I've seen several threads about reading contents, but nothing on writing to noscript.
$('body').append('<noscript><div></div></noscript>');
In Chrome and IE9 I get a noscript-element with a empty div inside like I expect, but in IE7 and IE8 I just get a empty noscript-element without the div inside.
Example: http://jsfiddle.net/cEMNS/
Is there a way to add HTML inside the noscript-tag that works in all browsers? What I need is to add some tracking code into a noscript-element at the end of the page, but the info I need isn't available until after document ready.
Edit: I'm getting a lot of comments on "why". It's some poorly done tracking library that requires this. We don't have access to the code to change it. Regardless, I find it interesting that it works in some browsers and not in others since jQuery was supposed to work equally in all browsers. Is it simply a bug?
Edit2: (2 years later) Adding a noscript on the browser doesn't make sense, I know. My only excuse not the question the task I had was because of lack of sleep, like everyone else in the project. But my rationale was that jQuery should behave the same on all browsers and someone might want to do this on the server.
Regardless of the tracking code, what you are doing (or are required to do) makes no sense!
Why? There are two cases possible here:
user has JavaScript enabled in which case the NOSCRIPT get's inserted into the DOM but is ignored by the browser (does nothing)
user does not have JavaScript enabled, NOSCRIPT does not get inserted and does not "execute"
The end result of both cases is that nothing actually happens.
Just an idea: You could try giving your noscript tag an ID, and then try to use native js.
for example:
$('body').append('<noscript id="myTestNoScript"></noscript>');
document.getElementById('myTestNoScript').innerHTML = '<div></div>';
I would claim that if it does not work with native js, it will not work with any library (feel free to correct me on this one).
I tried following simple HTML code:
<html>
<body>
<noscript>I'm a noscript tag.</noscript>
</body>
</html>
Then I did analyse this with IE8 (in IE7 mode) and his integrated code insprector. Apparently the IE7 checks are script allowed. If so he declared it as empty. And empty tags will be ignored. Unfortunatly I could not try that with disabled script option, because only the Systemadministrator can change the settings (here at my work).
What I can assure you, the noscript does exists. If you add
alert($('noscript').size());
after the creation, the result will be 1.
I want to figure out how a website reloads it's content using AJAX. Therefore i would like to see what JS functions are called in real time because I can't figure out what function is responsible for reloading the page dynamically. How to see all executed functions JS in real time in FF, Chrome, Opera or IE?
Maybe using the 'profile' button in the firebug console tab can give you an indication of the function(s) that are fired. Furthermore you can tell firebug's console to show xmlhttp requests (expand 'console' at the top of the firebug screen. After that, If an ajax request fires, it should be visible in the console. In the 'post' tab in such a request you may be able to infer the function triggering the request, looking at the parameters.
I think what you want is a feature in Chrome:
find the element that is being reloaded and right click,
choose inspect from context menu,
then right click the html of the element (in the bottom firebugish pane),
in the context menu there are options to:
break on subtree modifications
break on attributes modifications
break on node removal
in your case maybe set "break on subtree modifications" on the body tag would do it?
Article on awesome new dev features in chrome: http://www.elijahmanor.com/2011/08/7-chrome-tips-developers-designers-may.html
Install firebug in FF. Visit this link: http://getfirebug.com/
I would do a big search and replace on all the file using a regular expression that matches the function names (something like "function (.*)\((.*)\){") and use that to insert a console.log(functionName) at the beginning the function.
So you search for function (.*)\(.*\){ and replace it with function \1 (\2){ console.log("\1"); (Note: Regular expressions are most likely wrong as I didn't check them - you'll need some testing to get it right).
It seems a bit crazy but it should work. I've used that method to debug a Director Lingo project.
Obviously, make sure you backup the whole project before doing the replacement.
Following on the answer given in case you have access to the source code. With this regular expression you can do a console.log of all function calls:
search for:
function (.*){
replace with:
function \1 { console.log\(("\1")\);
I often using Firefox add-on JavaScript Deobfuscator
https://addons.mozilla.org/en-us/firefox/addon/javascript-deobfuscator/
I'm trying to use a component called Codemirror for in-browser source code editing. It works great, but IE7 has a bug (feature?) that autolinks all email addresses that are typed into the code editing window.
For example, if I type String x = "me#mydomain.com";, IE turns this into String x = me#mydomain.com; -- it strips the quotes and underlines it.
Does anyone know how to override or disable this? Thank you.
-tjw
I have heard about Codemirror, but I did not used it yet, have you tried:
· Changing the # for #?
· Adding a part of the string to the other?
· Parsing the final result to String again?
Using single quotes instead of double should work. I've tested it in IE8 and IE9 RC1.
I presume the component is using a Web Browser Control under the covers, which seems like an odd choice. You can prevent automatic hyperlink generation using ExecCommand(IDM_AUTOURLDETECT_MODE); see http://msdn.microsoft.com/en-us/library/aa769893(v=vs.85).aspx
Prior to IE9, it was not possible to specify IDM_AUTOURLDETECT_MODE from JavaScript, meaning that pages could not disable automatic hyperlinking in ContentEditable areas. A new command constant AutoUrlDetect is supported in IE9, allowing script to disable automatic hyperlinking as follows: document.execCommand("AutoUrlDetect", false, false)
I have a link created by the following html/javascript:
Copy Item
myDoc is: top.frames[0].document;
This is supposed to post the form. It works fine in all browsers when run outside an iframe, but, once I get it inside the iframe, it only works in IE and not in Firefox.
What am I doing wrong?
Ok: A follow-up. I got this to work, but now I'm wondering why I was able to. I set myDoc = top.frames[0].document; further up in the form creation and then I try to use it in the link declaration. It works fine in IE. But, when I'm in Firefox, I can't use myDoc. I have to explicitly use top.frames[0].document instead. Why is this?
That's probably because of some security issues. I would suggest putting the form inside the root-document and setting form.target to the name of the iframe.