Solved

use html tag with javascript?

Posted on 2014-03-06
5
312 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 51

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 51

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 51

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now