0
   <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

I would like to ask what did "javascript:" does in iframe src? I came across this code in a web application.

Basically, what i like about that is that they loaded body content via iframe -> like that google is doing. Does javascript: plays an important part?

E.g. http://www.webapplication.com/#Dashboard:142 Load content from dashboard.php / 142 is userid

E.g. http://www.webapplication.com/#settings:142 Load content from settings.php / 142 is userid

2 Answers 2

5
javascript:'' 

does absolutely nothing, it is used as a filler. Some use about:blank, or just an empty file, and this is another way.

Sign up to request clarification or add additional context in comments.

Comments

0

I just built this demo to answer another question: http://jsfiddle.net/JCpgY/

Used in src, javascript allows you to directly inject html strings in the iframe. As far as I know this is supported by all major browsers.

In your case it just allows to assign an empty value to src (this is mandatory). The author could also have used about:blank or javascript:void 0.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.