What does javascript: does in iframe src?

245 views Asked by At
   <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

There are 2 answers

0
Green Black On BEST ANSWER
javascript:'' 

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

0
Christophe On

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.