Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start script in HTML without <script> tag?

enter image description hereI'm using a low-code development platform called WaveMaker right now, and it gives you the option to customize the "markup" of the page (HTML, but you can't really edit <head>; the whole thing is kind of weird), the Javascript of the page, particularly with events like onpageload, etc., the style of the page (CSS), and the page's variables (JSON). I'm trying to embed Formstack forms, but every time the Markup section encounters a <script> tag, it deletes everything after the end of the tag. This is what the markup page looks like. I contacted support and they seemed to indicate that this was on purpose. Is there any way to make HTML run script included in-line without saying <script>? PS: I would be able to embed using iFrames, but for some reason the iFrames aren't working on the iPhone test program, even though they're working on the simulator.

like image 882
user8167940 Avatar asked Jun 15 '17 18:06

user8167940


People also ask

How can we write JavaScript without JavaScript tag?

Outside of HTML Tag: the <> are important. With these you can open a new Tag and the whole world is below your feet (or so...) Inside Javascript: Well...if you can break out of a string with '" , then you can basically write ';alert(1)

Does JavaScript need script tag?

JavaScript became the default language for HTML5 and modern browsers. Therefore, now adding text/javascript isn't required in <script> tag.

Can I have 2 scripts in HTML?

An HTML page can contain multiple <script> tags in the <head> or <body> tag. The browser executes all the script tags, starting from the first script tag from the beginning.

How to use the <script> tag in HTML?

The HTML <script> Tag. The <script> tag is used to define a client-side script (JavaScript). The <script> element either contains script statements, or it points to an external script file through the src attribute. Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content. To select an HTML...

How to write a JavaScript script in HTML?

HTML JavaScript 1 The HTML &lt;script&gt; Tag. The HTML <script> tag is used to define a client-side script (JavaScript). ... 2 A Taste of JavaScript 3 The HTML &lt;noscript&gt; Tag 4 HTML Exercises 5 HTML Script Tags. For a complete list of all available HTML tags, visit our HTML Tag Reference.

How to insert JavaScript in HTML?

The script tag is the primary method to insert JavaScript into HTML. The script tag was created by Netscape and was first implemented in Netscape Navigator 2, as far as the history of JavaScript is concerned. There are two ways you can use the script tag to insert JavaScript in HTML. You can insert JavaScript directly into an HTML file.

How do I write Hello JavaScript in HTML?

Write "Hello JavaScript!" with JavaScript: document.getElementById("demo").innerHTML = "Hello JavaScript!"; The <script> tag is used to embed a client-side script (JavaScript). The <script> element either contains scripting statements, or it points to an external script file through the src attribute.


2 Answers

What you can do is put it inside an HTML event attribute.

<body onload="/*your JS here*/">

</body>

If that does not work, try attaching onload to another HTML element or try one of the other event handlers (though I believe that they should have taken this into account as well)

like image 126
techfly Avatar answered Oct 26 '22 00:10

techfly


How about this :

<body onload="javascript:(function(){
// you can place your code here it should run
alert('ok')
})()">

</body>
like image 29
Riaz Laskar Avatar answered Oct 25 '22 23:10

Riaz Laskar