yhejazi2016 / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
0 stars 0 forks source link

webrowser settings UseJavaScript=false change to UseJavaScript =true when opening new webbrwser #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
lets say i want one webrowser to not use javascript so i use 
UseJavaScript=false then open new tab with new webbrowser i check the first one 
and UseJavaScript is now true because i open new webbrowser
thats a bug

Original issue reported on code.google.com by meirb...@gmail.com on 9 Dec 2011 at 2:14

GoogleCodeExporter commented 8 years ago
That's true. What I suggest is create a class which represents the 
WebKitBrowser object and add a property called PrivateScriptingEnabled 
(boolean). Then set that property to the value you want and add a handler to 
TabChanged event and detect if that value is set to true then also set 
UseJavascript to true and the opposite. Code example:

public class MyBrowser : WebKit.WebKitBrowser
{
    public bool PrivateScriptingEnabled { get; set; }
}

private void TabChanged(...)
{ 
    br = ((MyBrowser)currenttab.Controls[0]);
    br.UseJavaScript = br.PrivateScriptingEnabled;
}

This has to be done because by changing the UseJavaScript property the 
preferences of the whole engine change.

Original comment by tsumalis96@gmail.com on 9 Dec 2011 at 3:27

GoogleCodeExporter commented 8 years ago
so if UseJavaScript is global to the engine then is should only be in the 
WebKit.GlobalPreferences not per webbrowser Properties .

the above will not work with my problem:

i have an option to auto open a list of address in the same time to diffrent
webbrowsers/tabs  some of the address i need to disable scripting your
example only works with one at a time. 

ie has restricted sites list which disable script  i have used something like 
this
but it only work when opening one at a time and not multi address/tabs

Original comment by meirb...@gmail.com on 9 Dec 2011 at 4:56

GoogleCodeExporter commented 8 years ago
Then you should change the tabs and reload the browser that is selected every 
time the value is changed.

Original comment by tsumalis96@gmail.com on 9 Dec 2011 at 8:06

GoogleCodeExporter commented 8 years ago
reloading isn't much of solution, isnt there a way for you to make 
UseJavaScript work
per webbrowser and not global

Original comment by meirb...@gmail.com on 9 Dec 2011 at 9:13

GoogleCodeExporter commented 8 years ago
WebKit does not provide that functionality, so unless you go into the source of 
WebKit and modify it, it is not possible to do sth like that. Unfortunately I 
am not able to change the source of WebKit since I don't have the knowledge. I 
only read it to implement features to OWS, I cannot build my own build.

Original comment by tsumalis96@gmail.com on 10 Dec 2011 at 4:07