Solved

use html tag with javascript?

Posted on 2014-03-06
5
323 Views
Last Modified: 2014-03-07
i am using an iframe

i do not have html tags right now

just javascript

if i add html - want to add a title and favicon,

will this slow down the page?
speed is essential - 250mb file being loaded

where should i order html tags -before and end before javascript
or include javascript inside it?
0
Comment
Question by:finnstone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39911710
if i add html - want to add a title and favicon,
Do you want to add these inside the iframe? If so - you can't - security model prevents parent from modifying iframe child.
0
 

Author Comment

by:finnstone
ID: 39911723
No outside
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39911755
So what is the relevance of the iframe?
0
 
LVL 1

Assisted Solution

by:weaverk
weaverk earned 250 total points
ID: 39911911
In comparison to 250mb file, a title and favicon will not make a significant change to the speed...

personally i put my Js after the html

<!DOCTYPE html>
<html>
<body>
<h1>Title</h1>
...
... other html
...

<script>
... js here
</script>
</body>
</html>

Open in new window

0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 250 total points
ID: 39911980
The position does not matter.

Consider this code
<!doctype html>
<html>
<head>
</head>
<body>
<iframe src="http://www.marcorpsa.com/ee/slowpage.php"></iframe>
<script type="text/javascript">
	document.title = 'BOTTOM SCRIPT';
</script>
</body>
</html>

Open in new window

The slowpage.php file just delays 15 seconds before sending output - but as you will see from the code (http://www.marcorpsa.com/ee/t591.html) the title is set immediately.

This link (http://www.marcorpsa.com/ee/t591a.html) is the same script but with the JS at the beginning (<head>).

In both cases the title is set before the iframe loads
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question