Solved

use html tag with javascript?

Posted on 2014-03-06
5
314 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 53

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 53

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 53

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Split in Javascript 5 31
Error on link 14 40
Message not shown 5 34
Change CSS to show Notification Bar 9 19
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

863 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

24 Experts available now in Live!

Get 1:1 Help Now