HTML DOM designMode Property

Gauloran

Kıdemli Moderatör
7 Tem 2013
8,119
599
local
How to make any browser a basic html editor.
While working on one of my recent blogs, I stumbled upon an HTML DOM property that looked interesting.

In the past:

  • I had to see how the text change looks in a webpage – make change, ******* page or run the application again
  • I had to inspect, find the related DOM to make any text change to it and then write code to make the change to see it
  • I downloaded HTML page and then made some change in its text to add/edit/remove some comments for clean print.
  • Have some logic to provide an editable HTML page to users
Well, no more. Seems we have a new property (surely it was not there few years back but introduced recently): ********.designMode

I tried in Firefox, from menu items, go to: Tools -> Web Developer -> Web Console. Write:


Kod:
********.designMode = "on"


Post this, you can edit the webpage text right in your browser!
Sample real use case could be providing a portion of page editable to users. Add that in an iframe and then turn the designMode of that to ‘on’:


Kod:
iframeNode.content********.designMode = "on";


Quote:
A string indicating whether designMode is (or should be) set to on or off. Valid values are on and off
In Internet Explorer, it would be under Developer Tools, and so on for other browsers.

Browser Compatibility
Nice to have something like it to convert browser into a basic HTML editor! Keep learning. /This post is quoted

Reference


 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.