Search code examples
javascripthtmliframesanitization

Is it possible to create an iFrame with no spaces?


I'm in a situation where I need a substitute for the " " (space) character when writing an <iframe> (without using the forward slash).

<iframe src="\\12341234">

Is there any creative or interesting ideas for getting something like this to work without any spaces at all?

Even better, is there a way to use an iframe like this:

<iframe>
iframecontentshere
</iframe>

Solution

  • Yes as long as you can also run JavaScript. This assumes it is the only iframe in the page:

    <iframe></iframe>
    <script>document.querySelectorAll('iframe')[0].src="\\12341234";</script>
    

    But this seems dodgy.