Eval doesn't work on Firefox [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
As simple as the title says.
I have a bunch of scripts that work over some javascript code and should execute that code when pressing a button.
I use the eval function to do that and it works fine on:
GOOGLE CHROME
SAFARI
OPERA
INTERNET EXPLORER (?!?)
Surprisingly this doesn't work on Firefox and if I open the console here is the error I get:
[12:17:58.447] ReferenceError: undefinedundefinedundefinedundefinedundefined is not defined
Any idea on how to make it work even on FF?
EDIT.
here's the code I use. so much to work on!
function exec_code() {
var code= document.getElementById("code").innerText;
eval (code);
}

Firefox doesn't support the non-standard innerText property.
You can establish this by testing the value of code before you pass it to exec. It will be undefined.
Use something else to get your data.

Related

How to change the message “Changes you made may not be saved.” for window.onbeforeunload? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am trying to change messge “Changes you made may not be saved.” on leaving the page.I am using window.onbeforeunload for this.
Depending on which browsers you are referring to, you cannot change this message.
I assume you are referring to Chrome in this instance, which removed support for changing the beforeunload message as far back as v51: Chrome v51 Deprecations
The main reason it was removed was due to scammers using the message to trick people so Google made it always the same message to avoid confusion.
With this change, Chrome will be consistent with Safari 9.1 and later, as well as Firefox 4 and later.

CSS - Different result on IE, please save me [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am working on a OSCommerce site, and i can't figure out why is this happening.
You can check the website at the url: http://tendance24.com
The layout is completly different on IE and i'm wondering why cause all the should work for IE.
I am wondering if it couldn t be javascript.
Please let me know if you want me to upload all the css file somewhere, or anything else.
Thank you
It's because you're seeing it using Internet Explorer's Quirks Mode.
The website will only render correctly using Internet Explorer in Standards Mode.
If you press F12 when the Browser is in view and you'll be able to change this from Quirks to Standards mode.
This post will help solve the issue.

Why does JavaScript break after decompressing? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am trying to evaluate a very large JavaScript code. The file has been compressed with JavaScript Compressor and it was hard to understand the code. So I decompressed it using the JSFormat Package of Sublime Text editor. The code is now good to read however, when I run it in browser the code breaks. Why does this happen and what can I do to prevent it?
If the JavaScript in question runs in a web browser and works in Chrome, consider decompressing it using Chrome's built in JavaScript beautifying function, "Pretty print".
You can access the pretty printing feature by navigating to the developer console's script tab and clicking the {} curly brackets in the bottom left corner of the screen—if they're blue, the feature is on. Chrome's routines are probably more robust than the Sublime Text module's, so you might stand a better chance of getting working code out of it.
If by following the steps above you actually do manage to get working, cleanly formatted code, you can satisfy your curiosity by running the output of both code formatting engines through a diff program.

How to detect if a firefox extension is installed [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I Need a javascript to check if a firefox extension (not plugin) is installed.
I've created a clickonce application and I need my users can open the clickonce app with firefox, I know there is an extension from Microsoft to to this, but I need to know if that extension is installed, if not, I want to send to my users to the correct url to get the extension.
Thanks.
The only real way to do this outside of creating your own extension that reads other extensions is if the extension you are looking for injects something into the global variable scope that you can detect the presence of.
if('someExtensionObject' in window){ ... }

Running JS scripts conditionally in an HTML file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Because of browser related issues (ie, the view being different), I have two versions of a script. one that works on everything but IE, and one I wrote specifically to accomodate IE.I found this other script that detects what browser someone is using when they access a website. I was wondering, if there was anyway i could:
1.run this browser detect script FIRST to determine the boolean for IE/not IE
2. then, determining on this value, run one script or the other?
So... What's stopping you from doing:
var IE = checkBrowserFunction;
if(IE) {
doStuff();
}
? I mean, that seems fairly simple.

Categories

Resources