why break this up javascript fragment? [duplicate] - javascript

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Why split the <script> tag when writing it with document.write()?
I don't really do Javascript programming and was hard to google this but have seen something like this in a couple of different places (by good developers):
document.writeln('<scr'+'ipt src="'+pcheck+'" type="text/javascript"></scr'+'ipt>');
With the split always between the r and the i. What does this achieve?

This is to prevent any script blockers from loading this script, because they cannot find the "script" word within the text.

Related

Open page with "?data=data" like youtube.com/watch?v=videoID [duplicate]

This question already has answers here:
How can I get query string values in JavaScript?
(73 answers)
Closed 4 months ago.
How can I make an html detects this? For example, I have a game in html, can I save the score to url like "example.com/game?score=15", detect this and set score to information in url? Or at least something like that? If you know what it's called, please tell...
I tried to search (cause I don't exactly know what it is) in google and youtube but no answer.
These are what are known as Request Parameters.

What does '/in/' do in javascript [duplicate]

This question already has answers here:
What does this regex mean
(4 answers)
Closed 12 months ago.
After searching for 'working onload event' I found Abhishek's anwser which used /in/ and after that, I tried searching for it but couldn't find anything useful about it, does someone know what does it do?
Without more context, /in/ looks like a regular expression (as mentioned by VLAZ), which you can learn more about here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
I also like https://regex101.com/ for help reading or writing complex regular expressions. Just make sure to select the Javascript "flavor" as different languages implement regular expressions differently.

Textarea html tag with support `css` code [duplicate]

This question already has answers here:
Textarea that can do syntax highlighting on the fly?
(11 answers)
Closed 2 years ago.
I'm looking for textarea so I can write css code inside it. And have a good graphic appearance for displaying css code
As in the picture below:
There can be really one of two ways to do that: either you will implement it yourself OR use ready made libraries. Solutions like that exist in great variety and it could save you a lot of time to use one of following or find a similar one:
Edit Area
highlight.js
CodeMirror

Which alternative to use instead of document.write()? [duplicate]

This question already has answers here:
What are alternatives to document.write?
(11 answers)
Closed 3 years ago.
So guys, I made a little script to put in Tampermonkey for my presentations, but I have a problem.
What I want is to swap document.write(), but I don't know which function I could swap to replace it so that it leaves the code cleaner and more organized.
Besides document.write() is also not considered a good programming practice.
You could try to come up with your own function. But before taking any action, you need to think that there must be a injection into document body. You can try to use
document.body.appendChild()
and inside off that method, you can have some kind of html code.
Other than that you must generate a html document by using document.createDocumentFragment() or document.createElements().

Is there a program that will auto format my javascript? [duplicate]

This question already has answers here:
Closed 13 years ago.
Duplicate:
Javascript Beautifier
Is there a way I can auto format my javascript so its readable?
I have a javascript file that is just one line but about a million columns white. I don't want to go through and tab through each function just so I can read it.
Anyone know of a program that will do this for me?
Thanks!
On OS X use Textmate with the JavaScript bundle.

Categories