Solved

use html tag with javascript?

Posted on 2014-03-06
5
317 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
  • 3
5 Comments
 
LVL 54

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 54

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 54

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help to align the buttons in a row 2 27
CSS: How to get responsive tables to not be so spread out on desktop 5 35
key press alert 2 16
innerHTML 7 19
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

777 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